Merge pull request #4989 from blueyed/test_collect_capturing

test_collect_capturing: cover captured stderr
This commit is contained in:
Daniel Hahler 2019-03-25 23:41:53 +01:00 committed by GitHub
commit 3bc9cbea63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -134,12 +134,22 @@ def test_capturing_bytes_in_utf8_encoding(testdir, method):
def test_collect_capturing(testdir):
p = testdir.makepyfile(
"""
import sys
print("collect %s failure" % 13)
sys.stderr.write("collect %s_stderr failure" % 13)
import xyz42123
"""
)
result = testdir.runpytest(p)
result.stdout.fnmatch_lines(["*Captured stdout*", "*collect 13 failure*"])
result.stdout.fnmatch_lines(
[
"*Captured stdout*",
"collect 13 failure",
"*Captured stderr*",
"collect 13_stderr failure",
]
)
class TestPerTestCapturing(object):