Skip to content

Commit 884f150

Browse files
committed
mingw_smoketests: build extension in a venv
ensurepip no longer works since we implement PEP 668, so do everything in a venv.
1 parent 33a869a commit 884f150

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

mingw_smoketests.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,14 @@ def test_c_ext_build(self):
287287
import sys
288288
import subprocess
289289
import textwrap
290+
import venv
290291
from pathlib import Path
291292

292293
with tempfile.TemporaryDirectory() as tmppro:
293-
subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
294+
builder = venv.EnvBuilder(with_pip=True)
295+
builder.create(tmppro)
296+
venv_exe = os.path.join(tmppro, "bin", os.path.basename(sys.executable))
297+
294298
with Path(tmppro, "setup.py").open("w") as f:
295299
f.write(
296300
textwrap.dedent(
@@ -342,28 +346,19 @@ def test_c_ext_build(self):
342346
)
343347
)
344348
subprocess.check_call(
345-
[sys.executable, "-c", "import struct"],
346-
)
347-
subprocess.check_call(
348-
[
349-
sys.executable,
350-
"-m",
351-
"pip",
352-
"install",
353-
"wheel",
354-
],
349+
[venv_exe, "-c", "import struct"],
355350
)
356351
subprocess.check_call(
357352
[
358-
sys.executable,
353+
venv_exe,
359354
"-m",
360355
"pip",
361356
"install",
362357
tmppro,
363358
],
364359
)
365360
subprocess.check_call(
366-
[sys.executable, "-c", "import cwrapper"],
361+
[venv_exe, "-c", "import cwrapper"],
367362
)
368363

369364

0 commit comments

Comments
 (0)