Skip to content

Commit

Permalink
add assertions about returned failures
Browse files Browse the repository at this point in the history
  • Loading branch information
benclifford committed Jan 13, 2025
1 parent dddf414 commit 3c81397
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions parsl/tests/test_python_apps/test_fail.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,26 @@ def test_no_deps():
pass


@pytest.mark.parametrize("fail_probs", ((1, 0), (0, 1)))
def test_fail_sequence(fail_probs):
"""Test failure in a sequence of dependencies
def test_fail_sequence_first():
t1 = random_fail(fail_prob=1)
t2 = random_fail(fail_prob=0, inputs=[t1])
t_final = random_fail(fail_prob=0, inputs=[t2])

App1 -> App2 ... -> AppN
"""
with pytest.raises(DependencyError):
t_final.result()

t1_fail_prob, t2_fail_prob = fail_probs
t1 = random_fail(fail_prob=t1_fail_prob)
t2 = random_fail(fail_prob=t2_fail_prob, inputs=[t1])
assert len(t_final.exception().dependent_exceptions_tids) == 1
assert isinstance(t_final.exception().dependent_exceptions_tids[0][0], DependencyError)
assert t_final.exception().dependent_exceptions_tids[0][1].startswith("task ")


def test_fail_sequence_middle():
t1 = random_fail(fail_prob=0)
t2 = random_fail(fail_prob=1, inputs=[t1])
t_final = random_fail(fail_prob=0, inputs=[t2])

with pytest.raises(DependencyError):
t_final.result()

assert len(t_final.exception().dependent_exceptions_tids) == 1
assert isinstance(t_final.exception().dependent_exceptions_tids[0][0], ManufacturedTestFailure)

0 comments on commit 3c81397

Please sign in to comment.