test_pytest_exit_returncode: ignore ResourceWarnings

Fixes https://github.com/pytest-dev/pytest/issues/5088.
This commit is contained in:
Daniel Hahler 2019-04-14 21:55:15 +02:00
parent 19035f4b55
commit 1dd5f088fa
1 changed files with 8 additions and 1 deletions

View File

@ -581,7 +581,14 @@ def test_pytest_exit_returncode(testdir):
) )
result = testdir.runpytest() result = testdir.runpytest()
result.stdout.fnmatch_lines(["*! *Exit: some exit msg !*"]) result.stdout.fnmatch_lines(["*! *Exit: some exit msg !*"])
assert result.stderr.lines == [""] # Assert no output on stderr, except for unreliable ResourceWarnings.
# (https://github.com/pytest-dev/pytest/issues/5088)
assert [
x
for x in result.stderr.lines
if not x.startswith("Exception ignored in:")
and not x.startswith("ResourceWarning")
] == [""]
assert result.ret == 99 assert result.ret == 99
# It prints to stderr also in case of exit during pytest_sessionstart. # It prints to stderr also in case of exit during pytest_sessionstart.