55import os
66
77import pytest
8+ from _pytest .warnings import SHOW_PYTEST_WARNINGS_ARG
89
910pytestmark = pytest .mark .pytester_example_path ("deprecated" )
1011
1112
12- @pytest .mark .filterwarnings ("default" )
1313def test_yield_tests_deprecation (testdir ):
1414 testdir .makepyfile (
1515 """
@@ -23,7 +23,7 @@ def test_gen2():
2323 yield func1, 1, 1
2424 """
2525 )
26- result = testdir .runpytest ()
26+ result = testdir .runpytest (SHOW_PYTEST_WARNINGS_ARG )
2727 result .stdout .fnmatch_lines (
2828 [
2929 "*test_yield_tests_deprecation.py:3:*yield tests are deprecated*" ,
@@ -41,7 +41,7 @@ def test_foo(request):
4141 print(request.node.Module)
4242 """
4343 )
44- result = testdir .runpytest ()
44+ result = testdir .runpytest (SHOW_PYTEST_WARNINGS_ARG )
4545 result .stdout .fnmatch_lines (
4646 [
4747 "*test_compat_properties_deprecation.py:2:*usage of Function.Module is deprecated, "
@@ -63,7 +63,7 @@ def test_foo(fix):
6363 assert fix == 1
6464 """
6565 )
66- result = testdir .runpytest ()
66+ result = testdir .runpytest (SHOW_PYTEST_WARNINGS_ARG )
6767 result .stdout .fnmatch_lines (
6868 [
6969 "*test_cached_setup_deprecation.py:4:*cached_setup is deprecated*" ,
@@ -93,7 +93,7 @@ def test_foo(self):
9393 pass
9494 """
9595 )
96- result = testdir .runpytest ()
96+ result = testdir .runpytest (SHOW_PYTEST_WARNINGS_ARG )
9797 result .stdout .fnmatch_lines (
9898 [
9999 '*test_custom_class_deprecation.py:1:*"Class" objects in collectors of type "MyModule*' ,
@@ -102,7 +102,6 @@ def test_foo(self):
102102 )
103103
104104
105- @pytest .mark .filterwarnings ("default" )
106105def test_funcarg_prefix_deprecation (testdir ):
107106 testdir .makepyfile (
108107 """
@@ -113,7 +112,7 @@ def test_funcarg_prefix(value):
113112 assert value == 10
114113 """
115114 )
116- result = testdir .runpytest ("-ra" )
115+ result = testdir .runpytest ("-ra" , SHOW_PYTEST_WARNINGS_ARG )
117116 result .stdout .fnmatch_lines (
118117 [
119118 (
@@ -198,7 +197,6 @@ def test():
198197 )
199198
200199
201- @pytest .mark .filterwarnings ("always:Metafunc.addcall is deprecated" )
202200def test_metafunc_addcall_deprecated (testdir ):
203201 testdir .makepyfile (
204202 """
@@ -209,7 +207,7 @@ def test_func(i):
209207 pass
210208 """
211209 )
212- res = testdir .runpytest ("-s" )
210+ res = testdir .runpytest ("-s" , SHOW_PYTEST_WARNINGS_ARG )
213211 assert res .ret == 0
214212 res .stdout .fnmatch_lines (
215213 ["*Metafunc.addcall is deprecated*" , "*2 passed, 2 warnings*" ]
@@ -263,7 +261,7 @@ def test_func():
263261 pass
264262 """
265263 )
266- res = testdir .runpytest ()
264+ res = testdir .runpytest (SHOW_PYTEST_WARNINGS_ARG )
267265 assert res .ret == 0
268266 msg = str (PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST ).splitlines ()[0 ]
269267 res .stdout .fnmatch_lines (
@@ -292,6 +290,7 @@ def test_pytest_plugins_in_non_top_level_conftest_deprecated_pyargs(
292290 testdir .syspathinsert (testdir .tmpdir .join ("src" ))
293291
294292 args = ("--pyargs" , "pkg" ) if use_pyargs else ()
293+ args += (SHOW_PYTEST_WARNINGS_ARG ,)
295294 res = testdir .runpytest (* args )
296295 assert res .ret == 0
297296 msg = str (PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST ).splitlines ()[0 ]
0 commit comments