Skip to content

Commit 24d9012

Browse files
Make sure new venvs use the latest pip, etc. (#161)
1 parent aa2360d commit 24d9012

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pyperformance/run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def run_benchmarks(should_run, python, options):
6565
common = VenvForBenchmarks.ensure(
6666
_venv.get_venv_root(runid.name, python=info),
6767
info,
68+
upgrade='oncreate',
6869
inherit_environ=options.inherit_environ,
6970
)
7071

@@ -92,6 +93,7 @@ def run_benchmarks(should_run, python, options):
9293
venv = VenvForBenchmarks.ensure(
9394
venv_root,
9495
info,
96+
upgrade='oncreate',
9597
inherit_environ=options.inherit_environ,
9698
)
9799
try:

pyperformance/venv.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,15 @@ def ensure(cls, root, python=None, *,
150150
upgrade=False,
151151
**kwargs
152152
):
153-
if _venv.venv_exists(root):
153+
exists = _venv.venv_exists(root)
154+
if upgrade == 'oncreate':
155+
upgrade = not exists
156+
elif upgrade == 'onexists':
157+
upgrade = exists
158+
elif isinstance(upgrade, str):
159+
raise NotImplementedError(upgrade)
160+
161+
if exists:
154162
self = super().ensure(root)
155163
if upgrade:
156164
self.upgrade_pip()

0 commit comments

Comments
 (0)