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

Function test_capturing

testing/test_setuponly.py:237–256  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

235
236
237def test_capturing(pytester: Pytester) -> None:
238 p = pytester.makepyfile(
239 """
240 import pytest, sys
241 @pytest.fixture()
242 def one():
243 sys.stdout.write('this should be captured')
244 sys.stderr.write('this should also be captured')
245 @pytest.fixture()
246 def two(one):
247 assert 0
248 def test_capturing(two):
249 pass
250 """
251 )
252
253 result = pytester.runpytest("--setup-only", p)
254 result.stdout.fnmatch_lines(
255 ["this should be captured", "this should also be captured"]
256 )
257
258
259def test_show_fixtures_and_execute_test(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected