Skip to content

Commit

Permalink
Adequate venv fixtures to the latest change in virtualenv
Browse files Browse the repository at this point in the history
Since version v20.23.0, `virtualenv` will no longer include `wheel` and
`setuptools` in the created folders.

Some tests in the setuptools test suite assume that these packages are
always present. So we need to adequate these tests.
  • Loading branch information
abravalheri committed Apr 28, 2023
1 parent a0f6809 commit 90bc19f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 90bc19f

Please sign in to comment.