8000 Improve warning filtering in tests (#3175) · IBMZ-Linux-OSS-Python/black@1b6de7b · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b6de7b

Browse files
authored
Improve warning filtering in tests (psf#3175)
1 parent 33f0d9e commit 1b6de7b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ markers = [
4242
xfail_strict = true
4343
filterwarnings = [
4444
"error",
45+
# this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/
46+
# this ignore can be removed when support for aiohttp 3.7 is dropped.
4547
'''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''',
48+
# this is mitigated by https://github.com/python/cpython/issues/79071 in python 3.8+
49+
# this ignore can be removed when support for 3.7 is dropped.
4650
'''ignore:Bare functions are deprecated, use async ones:DeprecationWarning''',
47-
'''ignore:invalid escape sequence.*:DeprecationWarning''',
4851
]

tests/test_format.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def check_file(
2828
assert_format(source, expected, mode, fast=False)
2929

3030

31+
@pytest.mark.filterwarnings("ignore:invalid escape sequence.*:DeprecationWarning")
3132
@pytest.mark.parametrize("filename", all_data_cases("simple_cases"))
3233
def test_simple_format(filename: str) -> None:
3334
check_file("simple_cases", filename, DEFAULT_MODE)
@@ -132,6 +133,7 @@ def test_python_2_hint() -> None:
132133
exc_info.match(black.parsing.PY2_HINT)
133134

134135

136+
@pytest.mark.filterwarnings("ignore:invalid escape sequence.*:DeprecationWarning")
135137
def test_docstring_no_string_normalization() -> None:
136138
"""Like test_docstring but with string normalization off."""
137139
source, expected = read_data("miscellaneous", "docstring_no_string_normalization")

0 commit comments

Comments
 (0)
0