From ee17e7cdf5cae88b8807970581a995469e37e034 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 11 May 2023 06:13:17 -0400 Subject: test: try to silence a new warning For example: ``` .tox/anypy/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1004: 50 warnings /Users/nedbatchelder/coverage/trunk/.tox/anypy/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1004: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead expl_format = self.pop_format_context(ast.Str(expl)) ``` --- pyproject.toml | 1 + tests/conftest.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cf9c2c0e..d14ca17f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ filterwarnings = [ "ignore:the imp module is deprecated in favour of importlib:DeprecationWarning", "ignore:distutils Version classes are deprecated:DeprecationWarning", "ignore:The distutils package is deprecated and slated for removal in Python 3.12:DeprecationWarning", + "ignore:is deprecated and will be removed in Python 3.14; use ast.Constant instead:DeprecationWarning", ] # xfail tests that pass should fail the test suite diff --git a/tests/conftest.py b/tests/conftest.py index 41db85b4..6d3ec318 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -40,7 +40,7 @@ def set_warnings() -> None: warnings.simplefilter("once", DeprecationWarning) # Warnings to suppress: - # How come these warnings are successfully suppressed here, but not in setup.cfg?? + # How come these warnings are successfully suppressed here, but not in pyproject.toml?? warnings.filterwarnings( "ignore", @@ -54,6 +54,13 @@ def set_warnings() -> None: message=r"module 'sre_constants' is deprecated", ) + # From _pytest/assertion/rewrite.py + warnings.filterwarnings( + "ignore", + category=DeprecationWarning, + message=r"is deprecated and will be removed in Python 3.14; use ast.Constant instead", + ) + warnings.filterwarnings( "ignore", category=pytest.PytestRemovedIn8Warning, -- cgit v1.2.1