Skip to content

Commit 49cb48a

Browse files
authored
Merge pull request #1864 from EliahKagan/pip-toml
Use upgraded pip in test fixture virtual environment
2 parents d40e7d0 + a262a06 commit 49cb48a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/lib/helper.py

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import logging
1111
import os
1212
import os.path as osp
13+
import subprocess
14+
import sys
1315
import tempfile
1416
import textwrap
1517
import time
@@ -411,6 +413,13 @@ def __init__(self, env_dir, *, with_pip):
411413
self._env_dir = env_dir
412414
venv.create(self.env_dir, symlinks=True, with_pip=with_pip)
413415

416+
if with_pip:
417+
# The upgrade_deps parameter to venv.create is 3.9+ only, so do it this way.
418+
command = [self.python, "-m", "pip", "install", "--upgrade", "pip"]
419+
if sys.version_info < (3, 12):
420+
command.append("setuptools")
421+
subprocess.check_output(command)
422+
414423
@property
415424
def env_dir(self):
416425
"""The top-level directory of the environment."""

0 commit comments

Comments
 (0)