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

Method test_capturing_error_recursive

testing/test_capture.py:1184–1195  ·  view source on GitHub ↗

r"""For TeeStdCapture since we passthrough stderr/stdout, cap1 should get all output, while cap2 should only get "cap2\n".

(self)

Source from the content-addressed store, hash-verified

1182 captureclass = staticmethod(TeeStdCapture)
1183
1184 def test_capturing_error_recursive(self) -> None:
1185 r"""For TeeStdCapture since we passthrough stderr/stdout, cap1
1186 should get all output, while cap2 should only get "cap2\n"."""
1187
1188 with self.getcapture() as cap1:
1189 print("cap1")
1190 with self.getcapture() as cap2:
1191 print("cap2")
1192 out2, err2 = cap2.readouterr()
1193 out1, err1 = cap1.readouterr()
1194 assert out1 == "cap1\ncap2\n"
1195 assert out2 == "cap2\n"
1196
1197
1198class TestStdCaptureFD(TestStdCapture):

Callers

nothing calls this directly

Calls 2

getcaptureMethod · 0.80
readouterrMethod · 0.45

Tested by

no test coverage detected