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

Function test_nothing_logged

testing/logging/test_reporting.py:14–30  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

12
13
14def test_nothing_logged(pytester: Pytester) -> None:
15 pytester.makepyfile(
16 """
17 import sys
18
19 def test_foo():
20 sys.stdout.write('text going to stdout')
21 sys.stderr.write('text going to stderr')
22 assert False
23 """
24 )
25 result = pytester.runpytest()
26 assert result.ret == 1
27 result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"])
28 result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"])
29 with pytest.raises(pytest.fail.Exception):
30 result.stdout.fnmatch_lines(["*- Captured *log call -*"])
31
32
33def test_messages_logged(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