allow Null results - added test

This commit is contained in:
Ilan Steemers
2015-06-24 22:23:22 +02:00
parent 47de658be5
commit 06791005c9
2 changed files with 8 additions and 7 deletions
+1 -7
View File
@@ -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
+7
View File
@@ -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