(
pytester: Pytester,
exception_class: type[BaseException],
msg: str,
)
| 1896 | ], |
| 1897 | ) |
| 1898 | def test_respect_system_exceptions( |
| 1899 | pytester: Pytester, |
| 1900 | exception_class: type[BaseException], |
| 1901 | msg: str, |
| 1902 | ): |
| 1903 | head = "Before exception" |
| 1904 | tail = "After exception" |
| 1905 | ensure_file(pytester.path / "test_eggs.py").write_text( |
| 1906 | f"print('{head}')", encoding="UTF-8" |
| 1907 | ) |
| 1908 | ensure_file(pytester.path / "test_ham.py").write_text( |
| 1909 | f"raise {exception_class.__name__}()", encoding="UTF-8" |
| 1910 | ) |
| 1911 | ensure_file(pytester.path / "test_spam.py").write_text( |
| 1912 | f"print('{tail}')", encoding="UTF-8" |
| 1913 | ) |
| 1914 | |
| 1915 | result = pytester.runpytest_subprocess("-s") |
| 1916 | result.stdout.fnmatch_lines([f"*{head}*"]) |
| 1917 | result.stdout.fnmatch_lines([msg]) |
| 1918 | result.stdout.no_fnmatch_line(f"*{tail}*") |
| 1919 | |
| 1920 | |
| 1921 | def test_yield_disallowed_in_tests(pytester: Pytester): |
nothing calls this directly
no test coverage detected