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

Method test_capture_and_fixtures

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

Source from the content-addressed store, hash-verified

149
150class TestPerTestCapturing:
151 def test_capture_and_fixtures(self, pytester: Pytester) -> None:
152 p = pytester.makepyfile(
153 """
154 def setup_module(mod):
155 print("setup module")
156 def setup_function(function):
157 print("setup " + function.__name__)
158 def test_func1():
159 print("in func1")
160 assert 0
161 def test_func2():
162 print("in func2")
163 assert 0
164 """
165 )
166 result = pytester.runpytest(p)
167 result.stdout.fnmatch_lines(
168 [
169 "setup module*",
170 "setup test_func1*",
171 "in func1*",
172 "setup test_func2*",
173 "in func2*",
174 ]
175 )
176
177 @pytest.mark.xfail(reason="unimplemented feature")
178 def test_capture_scope_cache(self, 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