Skip to content

Commit 852ca7a

Browse files
authored
Merge pull request #5114 from blueyed/fixtest
test_pytest_exit_returncode: ignore ResourceWarnings
2 parents 45ba736 + f1f1862 commit 852ca7a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

testing/test_runner.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,14 @@ def test_foo():
581581
)
582582
result = testdir.runpytest()
583583
result.stdout.fnmatch_lines(["*! *Exit: some exit msg !*"])
584-
assert result.stderr.lines == [""]
584+
# Assert no output on stderr, except for unreliable ResourceWarnings.
585+
# (https://github.com/pytest-dev/pytest/issues/5088)
586+
assert [
587+
x
588+
for x in result.stderr.lines
589+
if not x.startswith("Exception ignored in:")
590+
and not x.startswith("ResourceWarning")
591+
] == [""]
585592
assert result.ret == 99
586593

587594
# It prints to stderr also in case of exit during pytest_sessionstart.

0 commit comments

Comments
 (0)