Skip to content

Commit 1dd5f08

Browse files
committed
test_pytest_exit_returncode: ignore ResourceWarnings
Fixes #5088.
1 parent 19035f4 commit 1dd5f08

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)