@@ -49,6 +49,13 @@ def count_meta_path(venv, env=None):
4949 return int (popen_text (venv .run )(cmd , env = win_sr (env )))
5050
5151
52+ skip_without_stdlib_distutils = pytest .mark .skipif (
53+ sys .version_info >= (3 , 12 ),
54+ reason = 'stdlib distutils is removed from Python 3.12+' ,
55+ )
56+
57+
58+ @skip_without_stdlib_distutils
5259def test_distutils_stdlib (venv ):
5360 """
5461 Ensure stdlib distutils is used when appropriate.
@@ -119,9 +126,9 @@ def test_distutils_has_origin():
119126@pytest .mark .parametrize (
120127 "distutils_version, imported_module" ,
121128 [
122- ("stdlib" , "dir_util" ),
123- ("stdlib" , "file_util" ),
124- ("stdlib" , "archive_util" ),
129+ pytest . param ("stdlib" , "dir_util" , marks = skip_without_stdlib_distutils ),
130+ pytest . param ("stdlib" , "file_util" , marks = skip_without_stdlib_distutils ),
131+ pytest . param ("stdlib" , "archive_util" , marks = skip_without_stdlib_distutils ),
125132 ("local" , "dir_util" ),
126133 ("local" , "file_util" ),
127134 ("local" , "archive_util" ),
@@ -147,7 +154,13 @@ def test_modules_are_not_duplicated_on_import(
147154"""
148155
149156
150- @pytest .mark .parametrize ("distutils_version" , "local stdlib" .split ())
157+ @pytest .mark .parametrize (
158+ "distutils_version" ,
159+ [
160+ "local" ,
161+ pytest .param ("stdlib" , marks = skip_without_stdlib_distutils ),
162+ ]
163+ )
151164def test_log_module_is_not_duplicated_on_import (distutils_version , tmpdir_cwd , venv ):
152165 env = dict (SETUPTOOLS_USE_DISTUTILS = distutils_version )
153166 cmd = ['python' , '-c' , ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED ]
0 commit comments