summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-07-28 12:11:50 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-07-28 12:11:50 (GMT)
commit5517596c0428ee3620c28fd68ba5a0b1627d59b6 (patch)
tree8d1fa6b14c787305bbf7e8c382fcbbe6f9aaf9ad /Lib/test/test_shutil.py
parent69e3bda310f55816403e4c7fda42ab96d81c31be (diff)
downloadcpython-5517596c0428ee3620c28fd68ba5a0b1627d59b6.zip
cpython-5517596c0428ee3620c28fd68ba5a0b1627d59b6.tar.gz
cpython-5517596c0428ee3620c28fd68ba5a0b1627d59b6.tar.bz2
Close #15415: Factor out temp dir helpers to test.support
Patch by Chris Jerdonek
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 6794a93..acaffdd 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1307,18 +1307,18 @@ class TestWhich(unittest.TestCase):
# that exists, it should be returned.
base_dir, tail_dir = os.path.split(self.dir)
relpath = os.path.join(tail_dir, self.file)
- with support.temp_cwd(path=base_dir):
+ with support.change_cwd(path=base_dir):
rv = shutil.which(relpath, path=self.temp_dir)
self.assertEqual(rv, relpath)
# But it shouldn't be searched in PATH directories (issue #16957).
- with support.temp_cwd(path=self.dir):
+ with support.change_cwd(path=self.dir):
rv = shutil.which(relpath, path=base_dir)
self.assertIsNone(rv)
def test_cwd(self):
# Issue #16957
base_dir = os.path.dirname(self.dir)
- with support.temp_cwd(path=self.dir):
+ with support.change_cwd(path=self.dir):
rv = shutil.which(self.file, path=base_dir)
if sys.platform == "win32":
# Windows: current directory implicitly on PATH
@@ -1339,7 +1339,7 @@ class TestWhich(unittest.TestCase):
def test_relative_path(self):
base_dir, tail_dir = os.path.split(self.dir)
- with support.temp_cwd(path=base_dir):
+ with support.change_cwd(path=base_dir):
rv = shutil.which(self.file, path=tail_dir)
self.assertEqual(rv, os.path.join(tail_dir, self.file))
@@ -1364,7 +1364,7 @@ class TestWhich(unittest.TestCase):
def test_empty_path(self):
base_dir = os.path.dirname(self.dir)
- with support.temp_cwd(path=self.dir), \
+ with support.change_cwd(path=self.dir), \
support.EnvironmentVarGuard() as env:
env['PATH'] = self.dir
rv = shutil.which(self.file, path='')