Merge pull request #5114 from blueyed/fixtest

test_pytest_exit_returncode: ignore ResourceWarnings
This commit is contained in:
Bruno Oliveira 2019-04-15 11:25:16 -03:00 committed by GitHub
commit 852ca7ad59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.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
# It prints to stderr also in case of exit during pytest_sessionstart.