Change RemovedInPytest4Warnings to errors by default

To keep existing tests which emit RemovedInPytest4Warnings running, decided
to go with a command line option because:

* Is harder to integrate an ini option with tests which already use an ini file
* It also marks tests which need to be removed/updated in 4.1, when
  RemovedInPytest4Warning and related functionality are removed.

Fix #3737
This commit is contained in:
Bruno Oliveira
2018-11-08 20:14:58 -02:00
parent b1312147e0
commit dc20dedbc7
17 changed files with 136 additions and 60 deletions

View File

@@ -14,6 +14,7 @@ import six
import pytest
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import EXIT_USAGEERROR
from _pytest.warnings import SHOW_PYTEST_WARNINGS_ARG
def prepend_pythonpath(*dirs):
@@ -307,7 +308,7 @@ class TestGeneralUsage(object):
"""
)
p = testdir.makepyfile("""def test_func(x): pass""")
res = testdir.runpytest(p)
res = testdir.runpytest(p, SHOW_PYTEST_WARNINGS_ARG)
assert res.ret == 0
res.stdout.fnmatch_lines(["*1 skipped*"])
@@ -321,7 +322,9 @@ class TestGeneralUsage(object):
pass
"""
)
res = testdir.runpytest(p.basename + "::" + "test_func[1]")
res = testdir.runpytest(
p.basename + "::" + "test_func[1]", SHOW_PYTEST_WARNINGS_ARG
)
assert res.ret == 0
res.stdout.fnmatch_lines(["*1 passed*"])