Skip to content

Commit

Permalink
PR feedback: Improve unit tests by assuming parseoutcomes and assert_…
Browse files Browse the repository at this point in the history
…outcomes
  • Loading branch information
bbrown1867 committed Mar 4, 2024
1 parent e11ad4d commit a022a1c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ def test_fail6():
assert result.ret == 2
# DSession should stop when the first failure is reached. Two failures
# may actually occur, due to timing.
result.stdout.re_match_lines([".*Interrupted: stopping.*[12].*"])
m = re.search(r"== (\d+) failed", str(result.stdout))
assert m
n_failed = int(m.groups()[0])
assert 1 <= n_failed <= 2
outcomes = result.parseoutcomes()
assert "failed" in outcomes, "Expected at least one failure"
assert 1 <= outcomes["failed"] <= 2, "Expected no more than 2 failures"

def test_basetemp_in_subprocesses(self, pytester: pytest.Pytester) -> None:
p1 = pytester.makepyfile(
Expand Down Expand Up @@ -1195,7 +1193,7 @@ def test2():
"""
)
result = pytester.runpytest_subprocess("--maxfail=1", "-n 1")
result.stdout.re_match_lines([".* 1 failed in .*"])
result.assert_outcomes(failed=1)


def test_internal_errors_propagate_to_controller(pytester: pytest.Pytester) -> None:
Expand Down

0 comments on commit a022a1c

Please sign in to comment.