Commit 5a7a9b85 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Test onError handler

parent 9b90641b
......@@ -600,6 +600,37 @@ def test_TaskThread_onFinish():
assert onFinishCalled[0]
def test_TaskThread_onError():
taskCalled = [False]
onFinishCalled = [False]
onErrorCalled = [False]
def task():
taskCalled[0] = True
raise Exception('Task error')
def onFinish():
onFinishCalled[0] = True
def onError(e):
onErrorCalled[0] = str(e)
tt = idle.TaskThread()
tt.enqueue(task, onFinish=onFinish, onError=onError)
assert taskCalled[0]
assert onErrorCalled[0] == 'Task error'
assert not onFinishCalled[0]
def test_TaskThread_isQueued():
called = [False]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment