@@ -75,10 +75,12 @@ def setuptools_sdist(tmp_path_factory, request):
7575 if dist :
7676 return dist
7777
78- subprocess .check_call ([
79- sys .executable , "-m" , "build" , "--sdist" ,
80- "--outdir" , str (tmp ), str (request .config .rootdir )
81- ])
78+ extra_setupcfg = _setupcfg_for_egginfo_isolation (tmp )
79+ with contexts .environment (DIST_EXTRA_CONFIG = extra_setupcfg ):
80+ subprocess .check_call ([
81+ sys .executable , "-m" , "build" , "--sdist" ,
82+ "--outdir" , str (tmp ), str (request .config .rootdir )
83+ ])
8284 return next (tmp .glob ("*.tar.gz" ))
8385
8486
@@ -93,13 +95,22 @@ def setuptools_wheel(tmp_path_factory, request):
9395 if dist :
9496 return dist
9597
96- subprocess .check_call ([
97- sys .executable , "-m" , "build" , "--wheel" ,
98- "--outdir" , str (tmp ) , str (request .config .rootdir )
99- ])
98+ extra_setupcfg = _setupcfg_for_egginfo_isolation (tmp )
99+ with contexts .environment (DIST_EXTRA_CONFIG = extra_setupcfg ):
100+ subprocess .check_call ([
101+ sys .executable , "-m" , "build" , "--wheel" ,
102+ "--outdir" , str (tmp ) , str (request .config .rootdir )
103+ ])
100104 return next (tmp .glob ("*.whl" ))
101105
102106
107+ def _setupcfg_for_egginfo_isolation (tmp_path ):
108+ # TODO: Remove this workaround when `build_meta` isolation is more reliable
109+ file = Path (tmp_path , "setup.cfg" )
110+ file .write_text (f"[egg_info]\n egg_base={ tmp_path } " , encoding = "utf-8" )
111+ return file
112+
113+
103114@pytest .fixture
104115def venv (tmp_path , setuptools_wheel ):
105116 """Virtual env with the version of setuptools under test installed"""
0 commit comments