Skip to content

Commit 1dac185

Browse files
committed
test: Fix test_link_error integration suite
The non-eager tests needed the manager fixture so that there was a worker to actually run the async tasks.
1 parent 564477c commit 1dac185

1 file changed

Lines changed: 31 additions & 35 deletions

File tree

t/integration/test_canvas.py

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,59 +44,55 @@ def flaky(fn):
4444

4545

4646
class test_link_error:
47-
@flaky
47+
# Eager execution shouldn't need the manager fixture
4848
def test_link_error_eager(self):
49-
exception = ExpectedException("Task expected to fail", "test")
50-
result = fail.apply(args=("test",), link_error=return_exception.s())
51-
actual = result.get(timeout=TIMEOUT, propagate=False)
52-
assert actual == exception
53-
54-
@flaky
55-
def test_link_error(self):
56-
exception = ExpectedException("Task expected to fail", "test")
57-
result = fail.apply(args=("test",), link_error=return_exception.s())
58-
actual = result.get(timeout=TIMEOUT, propagate=False)
59-
assert actual == exception
60-
61-
@flaky
62-
def test_link_error_callback_error_callback_retries_eager(self):
63-
exception = ExpectedException("Task expected to fail", "test")
6449
result = fail.apply(
65-
args=("test",),
66-
link_error=retry_once.s(countdown=None)
50+
args=("test",), link_error=return_exception.s()
6751
)
68-
assert result.get(timeout=TIMEOUT, propagate=False) == exception
52+
with pytest.raises(ExpectedException):
53+
result.get(timeout=TIMEOUT)
6954

70-
@flaky
71-
def test_link_error_callback_retries(self):
72-
exception = ExpectedException("Task expected to fail", "test")
73-
result = fail.apply_async(
55+
def test_link_error_callback_error_callback_retries_eager(self):
56+
result = fail.apply(
7457
args=("test",),
7558
link_error=retry_once.s(countdown=None)
7659
)
77-
assert result.get(timeout=TIMEOUT, propagate=False) == exception
60+
with pytest.raises(ExpectedException):
61+
result.get(timeout=TIMEOUT)
7862

79-
@flaky
8063
def test_link_error_using_signature_eager(self):
8164
fail = signature('t.integration.tasks.fail', args=("test",))
8265
retrun_exception = signature('t.integration.tasks.return_exception')
83-
8466
fail.link_error(retrun_exception)
67+
result = fail.apply()
68+
with pytest.raises(ExpectedException):
69+
result.get(timeout=TIMEOUT)
8570

86-
exception = ExpectedException("Task expected to fail", "test")
87-
assert (fail.apply().get(timeout=TIMEOUT, propagate=False), True) == (
88-
exception, True)
71+
@pytest.mark.usefixtures("manager")
72+
def test_link_error(self):
73+
result = fail.apply_async(
74+
args=("test",), link_error=return_exception.s()
75+
)
76+
with pytest.raises(ExpectedException):
77+
result.get(timeout=TIMEOUT)
8978

90-
@flaky
79+
@pytest.mark.usefixtures("manager")
80+
def test_link_error_callback_retries(self):
81+
result = fail.apply_async(
82+
args=("test",),
83+
link_error=retry_once.s(countdown=None)
84+
)
85+
with pytest.raises(ExpectedException):
86+
result.get(timeout=TIMEOUT)
87+
88+
@pytest.mark.usefixtures("manager")
9189
def test_link_error_using_signature(self):
9290
fail = signature('t.integration.tasks.fail', args=("test",))
9391
retrun_exception = signature('t.integration.tasks.return_exception')
94-
9592
fail.link_error(retrun_exception)
96-
97-
exception = ExpectedException("Task expected to fail", "test")
98-
assert (fail.delay().get(timeout=TIMEOUT, propagate=False), True) == (
99-
exception, True)
93+
result = fail.delay()
94+
with pytest.raises(ExpectedException):
95+
result.get(timeout=TIMEOUT)
10096

10197

10298
class test_chain:

0 commit comments

Comments
 (0)