Skip to content

Commit

Permalink
Skip stdlib distutils tests on Python 3.12
Browse files Browse the repository at this point in the history
This is an imperfect way to make the tests pass on Python 3.12.

Long-term goal is to deprecate the stdlib option,
see #3625
  • Loading branch information
hroncok committed Oct 13, 2022
1 parent 832a51c commit 3d7dd47
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions setuptools/tests/test_distutils_adoption.py
Expand Up @@ -49,6 +49,13 @@ def count_meta_path(venv, env=None):
return int(popen_text(venv.run)(cmd, env=win_sr(env)))


skip_without_stdlib_distutils = pytest.mark.skipif(
sys.version_info >= (3, 12),
reason='stdlib distutils is removed from Python 3.12+',
)


@skip_without_stdlib_distutils
def test_distutils_stdlib(venv):
"""
Ensure stdlib distutils is used when appropriate.
Expand Down Expand Up @@ -119,9 +126,9 @@ def test_distutils_has_origin():
@pytest.mark.parametrize(
"distutils_version, imported_module",
[
("stdlib", "dir_util"),
("stdlib", "file_util"),
("stdlib", "archive_util"),
pytest.param("stdlib", "dir_util", marks=skip_without_stdlib_distutils),
pytest.param("stdlib", "file_util", marks=skip_without_stdlib_distutils),
pytest.param("stdlib", "archive_util", marks=skip_without_stdlib_distutils),
("local", "dir_util"),
("local", "file_util"),
("local", "archive_util"),
Expand All @@ -147,7 +154,13 @@ def test_modules_are_not_duplicated_on_import(
"""


@pytest.mark.parametrize("distutils_version", "local stdlib".split())
@pytest.mark.parametrize(
"distutils_version",
[
"local",
pytest.param("stdlib", marks=skip_without_stdlib_distutils),
]
)
def test_log_module_is_not_duplicated_on_import(distutils_version, tmpdir_cwd, venv):
env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version)
cmd = ['python', '-c', ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED]
Expand Down

0 comments on commit 3d7dd47

Please sign in to comment.