diff --git a/django_q/tests/tasks.py b/django_q/tests/tasks.py index 4ac10a1..4258b14 100644 --- a/django_q/tests/tasks.py +++ b/django_q/tests/tasks.py @@ -1,13 +1,7 @@ -import time - -# simple countdown +# simple countdown, returns nothing def countdown(n): - start_time = time.time() while n > 0: n -= 1 - stop_time = time.time() - return stop_time - start_time - def count_letters(tup): total = 0 diff --git a/django_q/tests/test_q.py b/django_q/tests/test_q.py index c76bef5..462468c 100644 --- a/django_q/tests/test_q.py +++ b/django_q/tests/test_q.py @@ -108,10 +108,13 @@ def blah_async(): hook='django_q.tests.test_q.assert_bad_result') # unknown function d = async('django_q.tests.tasks.does_not_exist', WordClass(), hook='django_q.tests.test_q.assert_bad_result') + # function without result + e = async('django_q.tests.tasks.countdown', 100000) assert isinstance(a, str) assert isinstance(b, str) assert isinstance(c, str) assert isinstance(d, str) + assert isinstance(e, str) run_cluster() result_a = get_task(a) assert result_a is not None @@ -127,6 +130,10 @@ def blah_async(): result_d = get_task(d) assert result_d is not None assert result_d.success is False + result_e = get_task(e) + assert result_e is not None + assert result_e.success is True + assert result(b) is None @pytest.mark.django_db