(pytester: Pytester)
| 12 | |
| 13 | |
| 14 | def 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 | |
| 33 | def test_messages_logged(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected