22import sys
33from configparser import ConfigParser
44from itertools import product
5+ from pathlib import Path
56from typing import cast
67
78import jaraco .path
89import pytest
9- from path import Path
1010
1111import setuptools # noqa: F401 # force distutils.core to be patched
1212from setuptools .command .sdist import sdist
@@ -307,7 +307,7 @@ def test_setupcfg_metadata(self, tmp_path, folder, opts):
307307 assert dist .package_dir
308308 package_path = find_package_path ("pkg" , dist .package_dir , tmp_path )
309309 assert os .path .exists (package_path )
310- assert folder in Path (package_path ).parts ()
310+ assert folder in Path (package_path ).parts
311311
312312 _run_build (tmp_path , "--sdist" )
313313 dist_file = tmp_path / "dist/pkg-42.tar.gz"
@@ -618,7 +618,7 @@ def _get_dist(dist_path, attrs):
618618
619619 script = dist_path / 'setup.py'
620620 if script .exists ():
621- with Path (dist_path ):
621+ with jaraco . path . DirectoryStack (). context (dist_path ):
622622 dist = cast (
623623 Distribution ,
624624 distutils .core .run_setup ("setup.py" , {}, stop_after = "init" ),
@@ -628,7 +628,7 @@ def _get_dist(dist_path, attrs):
628628
629629 dist .src_root = root
630630 dist .script_name = "setup.py"
631- with Path (dist_path ):
631+ with jaraco . path . DirectoryStack (). context (dist_path ):
632632 dist .parse_config_files ()
633633
634634 dist .set_defaults ()
@@ -641,7 +641,7 @@ def _run_sdist_programatically(dist_path, attrs):
641641 cmd .ensure_finalized ()
642642 assert cmd .distribution .packages or cmd .distribution .py_modules
643643
644- with quiet (), Path (dist_path ):
644+ with quiet (), jaraco . path . DirectoryStack (). context (dist_path ):
645645 cmd .run ()
646646
647647 return dist , cmd
0 commit comments