MCPcopy
hub / github.com/pytest-dev/pytest / test_pass_output_reporting

Function test_pass_output_reporting

testing/test_terminal.py:1274–1311  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

1272
1273
1274def test_pass_output_reporting(pytester: Pytester) -> None:
1275 pytester.makepyfile(
1276 """
1277 def setup_module():
1278 print("setup_module")
1279
1280 def teardown_module():
1281 print("teardown_module")
1282
1283 def test_pass_has_output():
1284 print("Four score and seven years ago...")
1285
1286 def test_pass_no_output():
1287 pass
1288 """
1289 )
1290 result = pytester.runpytest()
1291 s = result.stdout.str()
1292 assert "test_pass_has_output" not in s
1293 assert "Four score and seven years ago..." not in s
1294 assert "test_pass_no_output" not in s
1295 result = pytester.runpytest("-rPp")
1296 result.stdout.fnmatch_lines(
1297 [
1298 "*= PASSES =*",
1299 "*_ test_pass_has_output _*",
1300 "*- Captured stdout setup -*",
1301 "setup_module",
1302 "*- Captured stdout call -*",
1303 "Four score and seven years ago...",
1304 "*- Captured stdout teardown -*",
1305 "teardown_module",
1306 "*= short test summary info =*",
1307 "PASSED test_pass_output_reporting.py::test_pass_has_output",
1308 "PASSED test_pass_output_reporting.py::test_pass_no_output",
1309 "*= 2 passed in *",
1310 ]
1311 )
1312
1313
1314def test_color_yes(pytester: Pytester, color_mapping) -> None:

Callers

nothing calls this directly

Calls 4

strMethod · 0.80
fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected