summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-08-06 20:22:08 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-08-06 20:22:08 (GMT)
commitd73c31899e88aa5a1cc28f288cc70a35f2a196c2 (patch)
tree09d9688677f61aed77153f5fe93cccbf7975619b /Lib/test/test_os.py
parent43b586b951aa3232261869640d379f942d0873da (diff)
downloadcpython-d73c31899e88aa5a1cc28f288cc70a35f2a196c2.zip
cpython-d73c31899e88aa5a1cc28f288cc70a35f2a196c2.tar.gz
cpython-d73c31899e88aa5a1cc28f288cc70a35f2a196c2.tar.bz2
Issue #26800: Undocumented support of general bytes-like objects
as paths in os functions is now deprecated.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index aa9b538..d8920d9 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -2626,6 +2626,7 @@ class OSErrorTests(unittest.TestCase):
else:
encoded = os.fsencode(support.TESTFN)
self.bytes_filenames.append(encoded)
+ self.bytes_filenames.append(bytearray(encoded))
self.bytes_filenames.append(memoryview(encoded))
self.filenames = self.bytes_filenames + self.unicode_filenames
@@ -2699,8 +2700,14 @@ class OSErrorTests(unittest.TestCase):
for filenames, func, *func_args in funcs:
for name in filenames:
try:
- with bytes_filename_warn(False):
+ if isinstance(name, str):
func(name, *func_args)
+ elif isinstance(name, bytes):
+ with bytes_filename_warn(False):
+ func(name, *func_args)
+ else:
+ with self.assertWarnsRegex(DeprecationWarning, 'should be'):
+ func(name, *func_args)
except OSError as err:
self.assertIs(err.filename, name)
else: