Skip to content

Commit b878bd6

Browse files
committed
WIP: Fix warning filters
1 parent 0ec4237 commit b878bd6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

testing/test_warnings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_normal_flow(pytester: Pytester, pyfile_with_warnings) -> None:
5555
)
5656

5757

58-
@pytest.mark.filterwarnings("always")
58+
@pytest.mark.filterwarnings("always::UserWarning")
5959
def test_setup_teardown_warnings(pytester: Pytester) -> None:
6060
pytester.makepyfile(
6161
"""
@@ -219,7 +219,7 @@ def test():
219219
warnings.warn(UserWarning(1, 'foo'))
220220
"""
221221
)
222-
result = pytester.runpytest("-W", "always")
222+
result = pytester.runpytest("-W", "always::UserWarning")
223223
result.stdout.fnmatch_lines(["*= 1 passed, 1 warning in *"])
224224

225225

@@ -299,7 +299,7 @@ def pytest_warning_recorded(self, warning_message, when, nodeid, location):
299299
assert collected_result[3] is None, str(collected)
300300

301301

302-
@pytest.mark.filterwarnings("always")
302+
@pytest.mark.filterwarnings("always::UserWarning")
303303
def test_collection_warnings(pytester: Pytester) -> None:
304304
"""Check that we also capture warnings issued during test collection (#3251)."""
305305
pytester.makepyfile(
@@ -323,7 +323,7 @@ def test_foo():
323323
)
324324

325325

326-
@pytest.mark.filterwarnings("always")
326+
@pytest.mark.filterwarnings("always::UserWarning")
327327
def test_mark_regex_escape(pytester: Pytester) -> None:
328328
"""@pytest.mark.filterwarnings should not try to escape regex characters (#3936)"""
329329
pytester.makepyfile(

0 commit comments

Comments
 (0)