Allow timeout unit tests to fail properly

The old implementation used count_forever test task that never finishes.
If the timeout implementation does not work in the test, the test never
end and you was required to kill the test runner.
This commit is contained in:
Janne Rönkkö
2019-01-26 20:45:38 +02:00
parent d09e2658be
commit 2650659da9

View File

@@ -252,7 +252,7 @@ def test_timeout(broker, cluster_config_timeout, async_task_kwargs):
# set up the Sentinel
broker.list_key = 'timeout_test:q'
broker.purge_queue()
async_task('django_q.tests.tasks.count_forever', broker=broker, **async_task_kwargs)
async_task('time.sleep', 5, broker=broker, **async_task_kwargs)
start_event = Event()
stop_event = Event()
# Set a timer to stop the Sentinel