def test_return_exception(app, create_builder):
    (workflow, builder) = create_builder('example', 'RETURN_EXCEPTION', {})
    result = builder.run()
    time.sleep(0.5)
    with app.app_context():
        tasks = {t.key: t.result for t in Task.query.all()}
    assert (tasks['STR'] == 'return_value')
    assert (list(tasks['TASK_ERROR'].keys()) == ['exception', 'traceback'])
    assert (tasks['TASK_ERROR']['exception'] == 'division by zero')
    assert tasks['TASK_ERROR']['traceback'].startswith('Traceback (most recent call last)')
    assert ('ZeroDivisionError: division by zero' in tasks['TASK_ERROR']['traceback'])
def test_return_exception(app, create_builder):
    (workflow, builder) = create_builder('example', 'RETURN_EXCEPTION', {})
    result = builder.run()
    time.sleep(0.5)
    with app.app_context():
        tasks = {t.key: t.result for t in Task.query.all()}
    assert (tasks['STR'] == 'return_value')
    assert (list(tasks['TASK_ERROR'].keys()) == ['exception', 'traceback'])
    assert (tasks['TASK_ERROR']['exception'] == 'division by zero')
    assert tasks['TASK_ERROR']['traceback'].startswith('Traceback (most recent call last)')
    assert ('ZeroDivisionError: division by zero' in tasks['TASK_ERROR']['traceback'])