diff --git a/conftest.py b/conftest.py index f82b939bd96..d5e851fe50b 100644 --- a/conftest.py +++ b/conftest.py @@ -1,5 +1,4 @@ import sys -import warnings pytest_plugins = 'setuptools.tests.fixtures' @@ -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', - ) diff --git a/pytest.ini b/pytest.ini index 2678afd8466..96c5916b631 100644 --- a/pytest.ini +++ b/pytest.ini @@ -34,3 +34,18 @@ 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 + warnings.filterwarnings( + '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