diazona/setuptools-pyproject-migration

"No module named 'distutils'" with old setuptools on Python 3.12

diazona opened this issue · 0 comments

On Python 3.12, when running tests with old versions of setuptools (using --force-dep in tox), specifically version 56, the pre-testing setup fails with this error:

$ tox -r -e py312 --force-dep setuptools==56
[...]
py312: commands[0]> pytest tests/test_classifiers.py
ImportError while loading conftest '/home/diazona/programming/setuptools-pyproject-migration/tests/conftest.py'.
tests/conftest.py:4: in <module>
    import test_support
test_support/test_support/__init__.py:1: in <module>
    import distutils.core
E   ModuleNotFoundError: No module named 'distutils'
py312: exit 4 (0.40 seconds) /home/diazona/programming/setuptools-pyproject-migration> pytest tests/test_classifiers.py pid=31540

Discovered in this example in CI.