Skip to content

Commit

Permalink
Start fixing venv test fixture pip toml bug
Browse files Browse the repository at this point in the history
This is not yet a usable fix, because venv.create only supports
upgrade_deps on Python 3.9 and higher.
  • Loading branch information
EliahKagan committed Mar 11, 2024
1 parent d40e7d0 commit dd8ee4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/lib/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ class VirtualEnvironment:

__slots__ = ("_env_dir",)

def __init__(self, env_dir, *, with_pip):
def __init__(self, env_dir, *, need_pip):
if os.name == "nt":
self._env_dir = osp.realpath(env_dir)
venv.create(self.env_dir, symlinks=False, with_pip=with_pip)
venv.create(self.env_dir, symlinks=False, with_pip=need_pip, upgrade_deps=need_pip)
else:
self._env_dir = env_dir
venv.create(self.env_dir, symlinks=True, with_pip=with_pip)
venv.create(self.env_dir, symlinks=True, with_pip=need_pip, upgrade_deps=need_pip)

@property
def env_dir(self):
Expand Down
2 changes: 1 addition & 1 deletion test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ def test_hook_uses_shell_not_from_cwd(self, rw_dir, case):
# from a venv may not run when copied outside of it, and a global interpreter
# won't run when copied to a different location if it was installed from the
# Microsoft Store. So we make a new venv in rw_dir and use its interpreter.
venv = VirtualEnvironment(rw_dir, with_pip=False)
venv = VirtualEnvironment(rw_dir, need_pip=False)
shutil.copy(venv.python, Path(rw_dir, shell_name))
shutil.copy(fixture_path("polyglot"), hook_path("polyglot", repo.git_dir))
payload = Path(rw_dir, "payload.txt")
Expand Down
2 changes: 1 addition & 1 deletion test/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_installation(self, rw_dir):

@staticmethod
def _set_up_venv(rw_dir):
venv = VirtualEnvironment(rw_dir, with_pip=True)
venv = VirtualEnvironment(rw_dir, need_pip=True)
os.symlink(
os.path.dirname(os.path.dirname(__file__)),
venv.sources,
Expand Down

0 comments on commit dd8ee4f

Please sign in to comment.