Weather: overcast clouds
This commit is contained in:
Anita Hammer 2024-04-08 03:00:31 +01:00
parent c0ffee6086
commit c0ffee73c6
No known key found for this signature in database
GPG Key ID: BCC8C52C76315D2F
1 changed files with 8 additions and 6 deletions

View File

@ -1864,17 +1864,19 @@ def test_do_not_collect_symlink_siblings(
def test_respect_system_exceptions(
pytester: Pytester, exception_class: Type[BaseException]
):
head = "Before exception"
tail = "After exception"
ensure_file(pytester.path / "test_bar.py").write_text(
"raise SystemError()", encoding="UTF-8"
f"print('{head}')", encoding="UTF-8"
)
ensure_file(pytester.path / "test_baz.py").write_text(
f"raise {exception_class.__name__}()", encoding="UTF-8"
)
ensure_file(pytester.path / "test_foo.py").write_text(
"raise NotImplementedError()", encoding="UTF-8"
f"print('{tail}')", encoding="UTF-8"
)
result = pytester.runpytest_subprocess()
result.stdout.fnmatch_lines(["*SystemError*"])
result.stderr.fnmatch_lines([f"*{exception_class.__name__}*"])
result.stdout.no_fnmatch_line("*NotImplementedError*")
result = pytester.runpytest_subprocess("-s")
result.stdout.fnmatch_lines([f"*{head}*"])
result.stdout.fnmatch_lines([f"*{exception_class.__name__}*"])
result.stdout.no_fnmatch_line(f"*{tail}*")