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

Method test_teardown_capturing

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

Source from the content-addressed store, hash-verified

218 assert "in func2" in s
219
220 def test_teardown_capturing(self, pytester: Pytester) -> None:
221 p = pytester.makepyfile(
222 """
223 def setup_function(function):
224 print("setup func1")
225 def teardown_function(function):
226 print("teardown func1")
227 assert 0
228 def test_func1():
229 print("in func1")
230 pass
231 """
232 )
233 result = pytester.runpytest(p)
234 result.stdout.fnmatch_lines(
235 [
236 "*teardown_function*",
237 "*Captured stdout*",
238 "setup func1*",
239 "in func1*",
240 "teardown func1*",
241 # "*1 fixture failure*"
242 ]
243 )
244
245 def test_teardown_capturing_final(self, pytester: Pytester) -> None:
246 p = pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected