Skip to content

Commit

Permalink
Check message explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed May 2, 2024
1 parent ef9bbb4 commit 386d0d3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions testing/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,9 +1860,17 @@ def test_do_not_collect_symlink_siblings(
result.assert_outcomes(passed=1)


@pytest.mark.parametrize("exception_class", (KeyboardInterrupt, SystemExit))
@pytest.mark.parametrize(
"exception_class, msg",
[
(KeyboardInterrupt, "*!!! KeyboardInterrupt !!!*"),
(SystemExit, "INTERNALERROR> SystemExit"),
],
)
def test_respect_system_exceptions(
pytester: Pytester, exception_class: Type[BaseException]
pytester: Pytester,
exception_class: Type[BaseException],
msg: str,
):
head = "Before exception"
tail = "After exception"
Expand All @@ -1878,5 +1886,5 @@ def test_respect_system_exceptions(

result = pytester.runpytest_subprocess("-s")
result.stdout.fnmatch_lines([f"*{head}*"])
result.stdout.fnmatch_lines([f"*{exception_class.__name__}*"])
result.stdout.fnmatch_lines([msg])
result.stdout.no_fnmatch_line(f"*{tail}*")

0 comments on commit 386d0d3

Please sign in to comment.