@@ -283,18 +283,18 @@ def test_site(self):
283283 self .assertEqual (len (site .getsitepackages ()), 1 )
284284
285285 def test_c_ext_build (self ):
286- # This will not work in in-tree build
287- if sysconfig .is_python_build ():
288- raise unittest .SkipTest ("in-tree build" )
289-
290286 import tempfile
291287 import sys
292288 import subprocess
293289 import textwrap
290+ import venv
294291 from pathlib import Path
295292
296293 with tempfile .TemporaryDirectory () as tmppro :
297- 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+
298298 with Path (tmppro , "setup.py" ).open ("w" ) as f :
299299 f .write (
300300 textwrap .dedent (
@@ -346,28 +346,19 @@ def test_c_ext_build(self):
346346 )
347347 )
348348 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- ],
349+ [venv_exe , "-c" , "import struct" ],
359350 )
360351 subprocess .check_call (
361352 [
362- sys . executable ,
353+ venv_exe ,
363354 "-m" ,
364355 "pip" ,
365356 "install" ,
366357 tmppro ,
367358 ],
368359 )
369360 subprocess .check_call (
370- [sys . executable , "-c" , "import cwrapper" ],
361+ [venv_exe , "-c" , "import cwrapper" ],
371362 )
372363
373364
0 commit comments