Skip to content

Commit b010f52

Browse files
authored
Adequate venv fixtures to the latest change in virtualenv for Python 3.12 (#3915)
2 parents e94cb20 + 3f17282 commit b010f52

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

changelog.d/3915.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adequate tests to the latest changes in ``virtualenv`` for Python 3.12.

setuptools/tests/fixtures.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def venv(tmp_path, setuptools_wheel):
105105
"""Virtual env with the version of setuptools under test installed"""
106106
env = environment.VirtualEnv()
107107
env.root = path.Path(tmp_path / 'venv')
108+
env.create_opts = ['--no-setuptools', '--wheel=bundle']
109+
# TODO: Use `--no-wheel` when setuptools implements its own bdist_wheel
108110
env.req = str(setuptools_wheel)
109111
# In some environments (eg. downstream distro packaging),
110112
# where tox isn't used to run tests and PYTHONPATH is set to point to
@@ -125,7 +127,7 @@ def venv_without_setuptools(tmp_path):
125127
"""Virtual env without any version of setuptools installed"""
126128
env = environment.VirtualEnv()
127129
env.root = path.Path(tmp_path / 'venv_without_setuptools')
128-
env.create_opts = ['--no-setuptools']
130+
env.create_opts = ['--no-setuptools', '--no-wheel']
129131
env.ensure_env()
130132
return env
131133

setuptools/tests/test_virtualenv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def sdist(distname, version):
174174

175175

176176
def test_test_command_install_requirements(venv, tmpdir, tmpdir_cwd):
177-
# Ensure pip/wheel packages are installed.
178-
venv.run(["python", "-c", "__import__('pkg_resources').require(['pip', 'wheel'])"])
177+
# Ensure pip is installed.
178+
venv.run(["python", "-c", "import pip"])
179179
# disable index URL so bits and bobs aren't requested from PyPI
180180
with contexts.environment(PYTHONPATH=None, PIP_NO_INDEX="1"):
181181
_check_test_command_install_requirements(venv, tmpdir)

setuptools/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from ._importlib import metadata
22

33
try:
4-
__version__ = metadata.version('setuptools')
4+
__version__ = metadata.version('setuptools') or '0.dev0+unknown'
55
except Exception:
6-
__version__ = 'unknown'
6+
__version__ = '0.dev0+unknown'

0 commit comments

Comments
 (0)