Skip to content

Adequate venv fixtures to the latest change in virtualenv for Python 3.12 #3915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3915.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adequate tests to the latest changes in ``virtualenv`` for Python 3.12.
4 changes: 3 additions & 1 deletion setuptools/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def venv(tmp_path, setuptools_wheel):
"""Virtual env with the version of setuptools under test installed"""
env = environment.VirtualEnv()
env.root = path.Path(tmp_path / 'venv')
env.create_opts = ['--no-setuptools', '--wheel=bundle']
# TODO: Use `--no-wheel` when setuptools implements its own bdist_wheel
env.req = str(setuptools_wheel)
# In some environments (eg. downstream distro packaging),
# where tox isn't used to run tests and PYTHONPATH is set to point to
Expand All @@ -125,7 +127,7 @@ def venv_without_setuptools(tmp_path):
"""Virtual env without any version of setuptools installed"""
env = environment.VirtualEnv()
env.root = path.Path(tmp_path / 'venv_without_setuptools')
env.create_opts = ['--no-setuptools']
env.create_opts = ['--no-setuptools', '--no-wheel']
env.ensure_env()
return env

Expand Down
4 changes: 2 additions & 2 deletions setuptools/tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def sdist(distname, version):


def test_test_command_install_requirements(venv, tmpdir, tmpdir_cwd):
# Ensure pip/wheel packages are installed.
venv.run(["python", "-c", "__import__('pkg_resources').require(['pip', 'wheel'])"])
# Ensure pip is installed.
venv.run(["python", "-c", "import pip"])
# disable index URL so bits and bobs aren't requested from PyPI
with contexts.environment(PYTHONPATH=None, PIP_NO_INDEX="1"):
_check_test_command_install_requirements(venv, tmpdir)
Expand Down
4 changes: 2 additions & 2 deletions setuptools/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ._importlib import metadata

try:
__version__ = metadata.version('setuptools')
__version__ = metadata.version('setuptools') or '0.dev0+unknown'
except Exception:
__version__ = 'unknown'
__version__ = '0.dev0+unknown'