test_as_errors: use subprocess with `-W`

Ref: https://github.com/pytest-dev/pytest/pull/4981
This commit is contained in:
Daniel Hahler 2019-03-24 11:17:55 +01:00
parent b3319a6074
commit 0ea1889265
1 changed files with 4 additions and 2 deletions

View File

@ -98,7 +98,9 @@ def test_as_errors(testdir, pyfile_with_warnings, method):
filterwarnings=error filterwarnings=error
""" """
) )
result = testdir.runpytest(*args) # Use a subprocess, since changing logging level affects other threads
# (xdist).
result = testdir.runpytest_subprocess(*args)
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
[ [
"E UserWarning: user warning", "E UserWarning: user warning",