Skip to content

Commit

Permalink
Move warning suppression to pytest.ini so it occurs after 'error'.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Nov 10, 2021
1 parent 65fab2f commit 2ceec37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
22 changes: 0 additions & 22 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import warnings


pytest_plugins = 'setuptools.tests.fixtures'
Expand Down Expand Up @@ -28,24 +27,3 @@ def pytest_addoption(parser):
if sys.version_info < (3, 6):
collect_ignore.append('docs/conf.py') # uses f-strings
collect_ignore.append('pavement.py')


if sys.version_info > (3, 10):
# https://github.com/pypa/setuptools/pull/2865#issuecomment-965700112
warnings.filterwarnings(
'ignore',
'The distutils.sysconfig module is deprecated, use sysconfig instead',
)


is_pypy = '__pypy__' in sys.builtin_module_names
if is_pypy:
# Workaround for pypa/setuptools#2868
warnings.filterwarnings(
'ignore',
'Distutils was imported before setuptools',
)
warnings.filterwarnings(
'ignore',
'Setuptools is replacing distutils',
)
12 changes: 12 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ filterwarnings=

# https://github.com/pypa/setuptools/issues/2497
ignore:.* is an invalid version and will not be supported::pkg_resources

# https://github.com/pypa/setuptools/pull/2865#issuecomment-965700112
# ideally would apply to Python 3.10+ when
# SETUPTOOLS_USE_DISTUTILS=stdlib but for
# https://github.com/pytest-dev/pytest/discussions/9296
ignore:The distutils.sysconfig module is deprecated, use sysconfig instead

# Workaround for pypa/setuptools#2868
# ideally would apply to PyPy only but for
# https://github.com/pytest-dev/pytest/discussions/9296
ignore:Distutils was imported before setuptools
ignore:Setuptools is replacing distutils

0 comments on commit 2ceec37

Please sign in to comment.