Skip to content

Commit 2034874

Browse files
Cope with DeprecationWarnings becoming SyntaxWarnings
1 parent 1ffb291 commit 2034874

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pylint/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
PY38_PLUS = sys.version_info[:2] >= (3, 8)
1818
PY39_PLUS = sys.version_info[:2] >= (3, 9)
1919
PY310_PLUS = sys.version_info[:2] >= (3, 10)
20+
PY312_PLUS = sys.version_info[:2] >= (3, 12)
2021

2122
IS_PYPY = platform.python_implementation() == "PyPy"
2223

tests/test_functional.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from _pytest.config import Config
1414

1515
from pylint import testutils
16+
from pylint.constants import PY312_PLUS
1617
from pylint.testutils import UPDATE_FILE, UPDATE_OPTION
1718
from pylint.testutils.functional import (
1819
FunctionalTestFile,
@@ -50,7 +51,8 @@ def test_functional(test_file: FunctionalTestFile, pytestconfig: Config) -> None
5051
lint_test.setUp()
5152

5253
if test_file.base in TEST_WITH_EXPECTED_DEPRECATION:
53-
with pytest.warns(DeprecationWarning, match="invalid escape sequence"):
54+
exception_type = SyntaxWarning if PY312_PLUS else DeprecationWarning
55+
with pytest.warns(exception_type, match="invalid escape sequence"):
5456
lint_test.runTest()
5557
else:
5658
lint_test.runTest()

0 commit comments

Comments
 (0)