From c0ffee73c66c972095f1febf5fb126a50822f8e7 Mon Sep 17 00:00:00 2001 From: Anita Hammer <166057949+anitahammer@users.noreply.github.com> Date: Mon, 8 Apr 2024 03:00:31 +0100 Subject: [PATCH] Fix test Weather: overcast clouds --- testing/test_collection.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/testing/test_collection.py b/testing/test_collection.py index 7c87e8695..f9c3cfafb 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -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}*")