Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Leverage virtualenv to ensure pip and setuptools and wheel are recent #25

Closed
wants to merge 9 commits into from
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased
==========

- #17: Like with ``virtualenv``, venvs are always created with a
late version of pip, setuptools, and wheel.

0.4.0 (2019-03-28)
==================

Expand Down
12 changes: 12 additions & 0 deletions src/tox_venv/hooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import platform
import subprocess

import tox
import virtualenv
from tox.venv import cleanup_for_venv


Expand Down Expand Up @@ -104,5 +106,15 @@ def tox_testenv_create(venv, action):
basepath.ensure(dir=1)
args.append(venv.path.basename)
venv._pcall(args, venv=False, action=action, cwd=basepath)
_update_installers(venv)
# Return non-None to indicate the plugin has completed
return True


def _update_installers(venv):
exe_dir = 'Scripts' if platform.system() == 'Windows' else 'bin'
exe = venv.path / exe_dir / 'python'
exe.dirpath().isdir() and virtualenv.install_wheel(
project_names=['setuptools', 'pip', 'wheel'],
py_executable=str(exe),
)
1 change: 0 additions & 1 deletion tests/test_z_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ def test_result_json(cmd, initproj, example123):
assert False, "missing {}".format(command_type)
for command in env_data[command_type]:
assert isinstance(command["command"], list)
assert command["output"]
assert "retcode" in command
assert isinstance(command["retcode"], int)
# virtualenv, deps install, package install, freeze
Expand Down