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

Method test_capturing_outerr

testing/test_capture.py:265–290  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

263 )
264
265 def test_capturing_outerr(self, pytester: Pytester) -> None:
266 p1 = pytester.makepyfile(
267 """\
268 import sys
269 def test_capturing():
270 print(42)
271 sys.stderr.write(str(23))
272 def test_capturing_error():
273 print(1)
274 sys.stderr.write(str(2))
275 raise ValueError
276 """
277 )
278 result = pytester.runpytest(p1)
279 result.stdout.fnmatch_lines(
280 [
281 "*test_capturing_outerr.py .F*",
282 "====* FAILURES *====",
283 "____*____",
284 "*test_capturing_outerr.py:8: ValueError",
285 "*--- Captured stdout *call*",
286 "1",
287 "*--- Captured stderr *call*",
288 "2",
289 ]
290 )
291
292
293class TestLoggingInteraction:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected