|
@@ -1,21 +1,22 @@
|
|
|
from __future__ import absolute_import, unicode_literals
|
|
|
import pytest
|
|
|
-from flaky import flaky
|
|
|
from celery import chain, chord, group
|
|
|
from celery.exceptions import TimeoutError
|
|
|
from celery.result import AsyncResult, GroupResult
|
|
|
+from .conftest import flaky
|
|
|
from .tasks import add, collect_ids, ids
|
|
|
|
|
|
TIMEOUT = 120
|
|
|
|
|
|
|
|
|
-@flaky
|
|
|
class test_chain:
|
|
|
|
|
|
+ @flaky
|
|
|
def test_simple_chain(self, manager):
|
|
|
c = add.s(4, 4) | add.s(8) | add.s(16)
|
|
|
assert c().get(timeout=TIMEOUT) == 32
|
|
|
|
|
|
+ @flaky
|
|
|
def test_complex_chain(self, manager):
|
|
|
c = (
|
|
|
add.s(2, 2) | (
|
|
@@ -26,6 +27,7 @@ class test_chain:
|
|
|
res = c()
|
|
|
assert res.get(timeout=TIMEOUT) == [32, 33, 34, 35]
|
|
|
|
|
|
+ @flaky
|
|
|
def test_parent_ids(self, manager, num=10):
|
|
|
assert manager.inspect().ping()
|
|
|
c = chain(ids.si(i=i) for i in range(num))
|
|
@@ -55,9 +57,9 @@ class test_chain:
|
|
|
i -= 1
|
|
|
|
|
|
|
|
|
-@flaky
|
|
|
class test_group:
|
|
|
|
|
|
+ @flaky
|
|
|
def test_parent_ids(self, manager):
|
|
|
assert manager.inspect().ping()
|
|
|
g = (
|
|
@@ -84,9 +86,9 @@ def assert_ids(r, expected_value, expected_root_id, expected_parent_id):
|
|
|
assert parent_id == expected_parent_id
|
|
|
|
|
|
|
|
|
-@flaky
|
|
|
class test_chord:
|
|
|
|
|
|
+ @flaky
|
|
|
def test_parent_ids(self, manager):
|
|
|
if not manager.app.conf.result_backend.startswith('redis'):
|
|
|
raise pytest.skip('Requires redis result backend.')
|
|
@@ -101,6 +103,7 @@ class test_chord:
|
|
|
)
|
|
|
self.assert_parentids_chord(g(), expected_root_id)
|
|
|
|
|
|
+ @flaky
|
|
|
def test_parent_ids__OR(self, manager):
|
|
|
if not manager.app.conf.result_backend.startswith('redis'):
|
|
|
raise pytest.skip('Requires redis result backend.')
|