Skip to content

Commit 3bc9cbe

Browse files
authored
Merge pull request #4989 from blueyed/test_collect_capturing
test_collect_capturing: cover captured stderr
2 parents d875844 + d0f3f26 commit 3bc9cbe

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

testing/test_capture.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,22 @@ def test_unicode():
134134
def test_collect_capturing(testdir):
135135
p = testdir.makepyfile(
136136
"""
137+
import sys
138+
137139
print("collect %s failure" % 13)
140+
sys.stderr.write("collect %s_stderr failure" % 13)
138141
import xyz42123
139142
"""
140143
)
141144
result = testdir.runpytest(p)
142-
result.stdout.fnmatch_lines(["*Captured stdout*", "*collect 13 failure*"])
145+
result.stdout.fnmatch_lines(
146+
[
147+
"*Captured stdout*",
148+
"collect 13 failure",
149+
"*Captured stderr*",
150+
"collect 13_stderr failure",
151+
]
152+
)
143153

144154

145155
class TestPerTestCapturing(object):

0 commit comments

Comments
 (0)