@@ -185,6 +185,7 @@ def virtualenv(tmp_path: Path) -> VEnv:
185185@dataclasses .dataclass (frozen = True )
186186class PackageInfo :
187187 name : str
188+ workdir : Path
188189 sdist_hash38 : str | None = None
189190 sdist_hash39 : str | None = None
190191 sdist_dated_hash39 : str | None = None
@@ -209,55 +210,59 @@ def source_date_epoch(self) -> str:
209210
210211def process_package (
211212 package : PackageInfo ,
212- tmp_path : Path ,
213213 monkeypatch : pytest .MonkeyPatch ,
214- pkg_path : str = "pkg" ,
215214) -> None :
216- package_dir = tmp_path / pkg_path
217- shutil .copytree (DIR / "packages" / package .name , package_dir )
218- monkeypatch .chdir (package_dir )
215+ pkg_src = DIR / "packages" / package .name
216+ assert pkg_src .exists ()
217+ shutil .copytree (pkg_src , package .workdir )
218+ monkeypatch .chdir (package .workdir )
219219
220220
221221@pytest .fixture
222222def package (
223- request : pytest .FixtureRequest , tmp_path : Path , monkeypatch : pytest .MonkeyPatch
223+ request : pytest .FixtureRequest ,
224+ tmp_path_factory : pytest .TempPathFactory ,
225+ monkeypatch : pytest .MonkeyPatch ,
224226) -> PackageInfo :
225227 pkg_name = request .param
226228 assert isinstance (pkg_name , str )
227- package = PackageInfo (pkg_name )
229+ package = PackageInfo (pkg_name , tmp_path_factory . mktemp ( "pkg" ) )
228230 assert (DIR / "packages" / package .name ).exists ()
229- process_package (package , tmp_path , monkeypatch )
231+ process_package (package , monkeypatch )
230232 return package
231233
232234
233235@pytest .fixture
234236def multiple_packages (
235- request : pytest .FixtureRequest , tmp_path : Path , monkeypatch : pytest .MonkeyPatch
237+ request : pytest .FixtureRequest ,
238+ tmp_path_factory : pytest .TempPathFactory ,
239+ monkeypatch : pytest .MonkeyPatch ,
236240) -> list [PackageInfo ]:
237241 package_names = request .param
238242 assert isinstance (package_names , Iterable )
239243 packages = []
240244 for pkg_name in package_names :
241- pkg = PackageInfo (pkg_name )
242- assert (DIR / "packages" / pkg .name ).exists ()
243- process_package (pkg , tmp_path , monkeypatch , pkg_path = pkg .name )
245+ pkg = PackageInfo (pkg_name , tmp_path_factory .mktemp ("pkg" ))
246+ process_package (pkg , monkeypatch )
244247 packages .append (pkg )
245- monkeypatch .chdir (tmp_path )
248+ monkeypatch .chdir (tmp_path_factory . getbasetemp () )
246249 return packages
247250
248251
249252@pytest .fixture
250253def package_simple_pyproject_ext (
251- tmp_path : Path , monkeypatch : pytest .MonkeyPatch
254+ tmp_path_factory : pytest .TempPathFactory ,
255+ monkeypatch : pytest .MonkeyPatch ,
252256) -> PackageInfo :
253257 package = PackageInfo (
254258 "simple_pyproject_ext" ,
259+ tmp_path_factory .mktemp ("pkg" ),
255260 "71b4e95854ef8d04886758d24d18fe55ebe63648310acf58c7423387cca73508" ,
256261 "ed930179fbf5adc2e71a64a6f9686c61fdcce477c85bc94dd51598641be886a7" ,
257262 "0178462b64b4eb9c41ae70eb413a9cc111c340e431b240af1b218fe81b0c2ecb" ,
258263 "de79895a9d5c2112257715214ab419d3635e841716655e8a55390e5d52445819" ,
259264 )
260- process_package (package , tmp_path , monkeypatch )
265+ process_package (package , monkeypatch )
261266 return package
262267
263268
0 commit comments