Skip to content

Commit

Permalink
test: suppress an ast deprecation warning
Browse files Browse the repository at this point in the history
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 a  nd will be removed in Python 3.14; use ast.Constant instead
    expl_format = self.pop_format_context(ast.Str(expl))
```
  • Loading branch information
nedbat committed May 20, 2023
1 parent 5925d8a commit 37b922a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ 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
Expand Down
7 changes: 0 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ 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,
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ setenv =
# For some tests, we need .pyc files written in the current directory,
# so override any local setting.
PYTHONPYCACHEPREFIX=
PYTHONWARNINGS=ignore:removed in Python 3.14; use ast.Constant:DeprecationWarning

# $set_env.py: COVERAGE_PIP_ARGS - Extra arguments for `pip install`
# `--no-build-isolation` will let tox work with no network.
Expand Down

0 comments on commit 37b922a

Please sign in to comment.