summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shutil.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-12-16 21:48:48 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-12-16 21:48:48 (GMT)
commitfffb96ba66ab46c2de48e228d69ab10a19b1ea2d (patch)
tree27e45b60f5c184dac7a7ec03655a273b92ccb379 /Lib/test/test_shutil.py
parenta4275b276c14d0de21fb8e9210dcf302c6dd5fd8 (diff)
downloadcpython-fffb96ba66ab46c2de48e228d69ab10a19b1ea2d.zip
cpython-fffb96ba66ab46c2de48e228d69ab10a19b1ea2d.tar.gz
cpython-fffb96ba66ab46c2de48e228d69ab10a19b1ea2d.tar.bz2
Issue #18283: shutil.which() now supports bytes argument, not only text argument.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r--Lib/test/test_shutil.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 98ea6d1..7314782 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1326,6 +1326,7 @@ class TestWhich(unittest.TestCase):
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)
+ self.env_path = self.dir
def test_basic(self):
# Given an EXE in a directory, it should be returned.
@@ -1394,7 +1395,7 @@ class TestWhich(unittest.TestCase):
def test_environ_path(self):
with support.EnvironmentVarGuard() as env:
- env['PATH'] = self.dir
+ env['PATH'] = self.env_path
rv = shutil.which(self.file)
self.assertEqual(rv, self.temp_file.name)
@@ -1402,7 +1403,7 @@ class TestWhich(unittest.TestCase):
base_dir = os.path.dirname(self.dir)
with support.change_cwd(path=self.dir), \
support.EnvironmentVarGuard() as env:
- env['PATH'] = self.dir
+ env['PATH'] = self.env_path
rv = shutil.which(self.file, path='')
self.assertIsNone(rv)
@@ -1413,6 +1414,14 @@ class TestWhich(unittest.TestCase):
self.assertIsNone(rv)
+class TestWhichBytes(TestWhich):
+ def setUp(self):
+ TestWhich.setUp(self)
+ self.dir = os.fsencode(self.dir)
+ self.file = os.fsencode(self.file)
+ self.temp_file.name = os.fsencode(self.temp_file.name)
+
+
class TestMove(unittest.TestCase):
def setUp(self):