From 354208206b2146eee0c9117de969d98c9aa8447b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 Nov 2021 09:02:31 -0500 Subject: [PATCH] Avoid upgrading setuptools when creating the venv for distutils_adoption tests. Works around issue with upgrading on PyPy. --- setup.cfg | 2 +- setuptools/tests/test_distutils_adoption.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index 66cad330a2..44b1af2b02 100644 --- a/setup.cfg +++ b/setup.cfg @@ -59,7 +59,7 @@ testing = wheel paver pip>=19.1 # For proper file:// URLs support. - jaraco.envs + jaraco.envs>=2.2 pytest-xdist sphinx jaraco.path>=3.2.0 diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index 0e89921c90..006480dde5 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -9,11 +9,13 @@ import path -IS_PYPY = '__pypy__' in sys.builtin_module_names - - class VirtualEnv(jaraco.envs.VirtualEnv): name = '.env' + # Some version of PyPy will import distutils on startup, implicitly + # importing setuptools, and thus leading to BackendInvalid errors + # when upgrading Setuptools. Bypass this behavior by avoiding the + # early availability and need to upgrade. + create_opts = ['--no-setuptools'] def run(self, cmd, *args, **kwargs): cmd = [self.exe(cmd[0])] + cmd[1:] @@ -61,7 +63,6 @@ def test_distutils_local_with_setuptools(venv): assert venv.name in loc.split(os.sep) -@pytest.mark.xfail('IS_PYPY', reason='pypy imports distutils on startup') def test_distutils_local(venv): """ Even without importing, the setuptools-local copy of distutils is