summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-21 13:01:34 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-21 13:01:34 (GMT)
commit5b987c2e68947732b673d6c8d6117011730d28f0 (patch)
tree09c808b4bd0c31d47f3785cd35e0f167340b0217 /Lib/test/test_shutil.py
parent5a95977c71d19d6aed32b0a4721d5e9ef4888efe (diff)
parent014791f8484036b1c0040ea0de7a6a4c05f0aeed (diff)
downloadcpython-5b987c2e68947732b673d6c8d6117011730d28f0.zip
cpython-5b987c2e68947732b673d6c8d6117011730d28f0.tar.gz
cpython-5b987c2e68947732b673d6c8d6117011730d28f0.tar.bz2
Issue #16993: shutil.which() now preserves the case of the path and extension
on Windows.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index f7b14b8..eafa628 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1280,12 +1280,13 @@ class TestShutil(unittest.TestCase):
class TestWhich(unittest.TestCase):
def setUp(self):
- self.temp_dir = tempfile.mkdtemp()
+ self.temp_dir = tempfile.mkdtemp(prefix="Tmp")
self.addCleanup(shutil.rmtree, self.temp_dir, True)
# Give the temp_file an ".exe" suffix for all.
# It's needed on Windows and not harmful on other platforms.
self.temp_file = tempfile.NamedTemporaryFile(dir=self.temp_dir,
- suffix=".exe")
+ prefix="Tmp",
+ suffix=".Exe")
os.chmod(self.temp_file.name, stat.S_IXUSR)
self.addCleanup(self.temp_file.close)
self.dir, self.file = os.path.split(self.temp_file.name)
@@ -1328,7 +1329,7 @@ class TestWhich(unittest.TestCase):
# Ask for the file without the ".exe" extension, then ensure that
# it gets found properly with the extension.
rv = shutil.which(self.temp_file.name[:-4], path=self.dir)
- self.assertEqual(self.temp_file.name, rv)
+ self.assertEqual(rv, self.temp_file.name[:-4] + ".exe")
class TestMove(unittest.TestCase):