Skip to content

Commit

Permalink
Fixed tests in async environments
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Apr 12, 2017
1 parent 2b4773b commit 7b7f68f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/test_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ def test_promises_with_only_then():
promise3 = promise1.then(lambda x: None)
context["promise1_reject"](error)

promise1._wait()
promise2._wait()
promise3._wait()
assert promise2.reason == error
assert promise3.reason == error

Expand Down
4 changes: 3 additions & 1 deletion tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ def test_issue_26():
context["promise1_reject"](RuntimeError("Ooops!"))

promise2 = Promise(lambda resolve, reject: context.update({"promise2_resolve": resolve}))
promise2.then(lambda x: context.update({"success": True}))
promise3 = promise2.then(lambda x: context.update({"success": True}))
context["promise2_resolve"](None)

# We wait so it works in asynchronous envs
promise3._wait(timeout=.1)
assert context["success"]


Expand Down

0 comments on commit 7b7f68f

Please sign in to comment.