Skip to content

Commit 3b5339c

Browse files
lazkanaveen521kk
authored andcommitted
mingw_smoketests: build extension in a venv
ensurepip no longer works since we implement PEP 668, so do everything in a venv.
1 parent 0649b85 commit 3b5339c

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
@@ -291,10 +291,14 @@ def test_c_ext_build(self):
291291
import sys
292292
import subprocess
293293
import textwrap
294+
import venv
294295
from pathlib import Path
295296

296297
with tempfile.TemporaryDirectory() as tmppro:
297-
subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
298+
builder = venv.EnvBuilder(with_pip=True)
299+
builder.create(tmppro)
300+
venv_exe = os.path.join(tmppro, "bin", os.path.basename(sys.executable))
301+
298302
with Path(tmppro, "setup.py").open("w") as f:
299303
f.write(
300304
textwrap.dedent(
@@ -346,28 +350,19 @@ def test_c_ext_build(self):
346350
)
347351
)
348352
subprocess.check_call(
349-
[sys.executable, "-c", "import struct"],
350-
)
351-
subprocess.check_call(
352-
[
353-
sys.executable,
354-
"-m",
355-
"pip",
356-
"install",
357-
"wheel",
358-
],
353+
[venv_exe, "-c", "import struct"],
359354
)
360355
subprocess.check_call(
361356
[
362-
sys.executable,
357+
venv_exe,
363358
"-m",
364359
"pip",
365360
"install",
366361
tmppro,
367362
],
368363
)
369364
subprocess.check_call(
370-
[sys.executable, "-c", "import cwrapper"],
365+
[venv_exe, "-c", "import cwrapper"],
371366
)
372367

373368

0 commit comments

Comments
 (0)