Tests fail when tox/virtualenv installs setuptools 60+
jaraco opened this issue · comments
In this build against 79f6a3f, the tests started failing. I don't suspect that commit but rather that something in the ecosystem changed (perhaps the version of Setuptools installed to environments by default).
Errors on Python 3.9 look like:
_________________ ERROR collecting distutils/_msvccompiler.py __________________
.tox/python/lib/python3.9/site-packages/_pytest/runner.py:311: in from_call
result: Optional[TResult] = func()
.tox/python/lib/python3.9/site-packages/_pytest/runner.py:341: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
.tox/python/lib/python3.9/site-packages/_pytest/doctest.py:532: in collect
module = import_path(self.fspath)
.tox/python/lib/python3.9/site-packages/_pytest/pathlib.py:544: in import_path
raise ImportPathMismatchError(module_name, module_file, path)
E _pytest.pathlib.ImportPathMismatchError: ('distutils._msvccompiler', '/home/runner/work/distutils/distutils/.tox/python/lib/python3.9/site-packages/setuptools/_distutils/_msvccompiler.py', PosixPath('/home/runner/work/distutils/distutils/distutils/_msvccompiler.py'))
I've thusfar been unable to replicate the issue on my system.
In https://github.com/pypa/distutils/runs/4660518340?check_suite_focus=true, I made a branch of the previously-passing code and it's still failing, so the issue is indeed with the ecosystem and not with the recent changes.
I can replicate the issue by upgrading to Python 3.9.9 from 3.9.6. My guess is that virtualenv gets its setuptools from Python and the updated version of Python has a new Setuptools with 60.x.
Setting $VIRTUALENV_NO_SETUPTOOLS
seems to work around the issue.
This issue is now suddenly affecting my local install, presumably because I rebuilt my environment after updating tox/virtualenv. I think the issue needs to be addressed in tox.ini and not in CI.