From ec06d3f4f8d8ba387d79d95d988937866a7794df Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 Jul 2018 12:59:02 +0200 Subject: [PATCH] tests: fix occasional timing issue in future test --- tests/event/test_futures.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/event/test_futures.py b/tests/event/test_futures.py index 0778605da4..e120a2ab8e 100644 --- a/tests/event/test_futures.py +++ b/tests/event/test_futures.py @@ -48,10 +48,9 @@ def test_future_wait(): fut.set_result(None) thread = threading.Thread(target=thread_main) - thread.start() - # Make sure it didn't sneakily already run the thread assert not fut.done() + thread.start() assert fut.result() is None @@ -69,10 +68,9 @@ def test_future_wait_cancel(): fut.cancel() thread = threading.Thread(target=thread_main) - thread.start() - # Make sure it didn't sneakily already run the thread assert not fut.done() + thread.start() with pytest.raises(CancelledError): fut.result()