MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_error_during_readouterr

Function test_error_during_readouterr

testing/test_capture.py:829–845  ·  view source on GitHub ↗

Make sure we suspend capturing if errors occur during readouterr

(pytester: Pytester)

Source from the content-addressed store, hash-verified

827
828
829def test_error_during_readouterr(pytester: Pytester) -> None:
830 """Make sure we suspend capturing if errors occur during readouterr"""
831 pytester.makepyfile(
832 pytest_xyz="""
833 from _pytest.capture import FDCapture
834
835 def bad_snap(self):
836 raise Exception('boom')
837
838 assert FDCapture.snap
839 FDCapture.snap = bad_snap
840 """
841 )
842 result = pytester.runpytest_subprocess("-p", "pytest_xyz", "--version")
843 result.stderr.fnmatch_lines(
844 ["*in bad_snap", " raise Exception('boom')", "Exception: boom"]
845 )
846
847
848class TestCaptureIO:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytest_subprocessMethod · 0.45

Tested by

no test coverage detected