summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericpath.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-15 21:27:41 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-15 21:27:41 (GMT)
commit1ab6c2d2c2b6c78e492491542007edfb880889f0 (patch)
tree2933764c675aa8f715a176c7ae0cb8486bdd0f0a /Lib/test/test_genericpath.py
parent6166519d2bfb0b6fd7ff304da89c59b10557d4a3 (diff)
downloadcpython-1ab6c2d2c2b6c78e492491542007edfb880889f0.zip
cpython-1ab6c2d2c2b6c78e492491542007edfb880889f0.tar.gz
cpython-1ab6c2d2c2b6c78e492491542007edfb880889f0.tar.bz2
Issue #13374: The Windows bytes API has been deprecated in the os module. Use
Unicode filenames instead of bytes filenames to not depend on the ANSI code page anymore and to support any filename.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r--Lib/test/test_genericpath.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index 50638a1..b618d45 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -2,11 +2,12 @@
Tests common to genericpath, macpath, ntpath and posixpath
"""
-import unittest
-from test import support
-import os
import genericpath
+import os
import sys
+import unittest
+import warnings
+from test import support
def safe_rmdir(dirname):
@@ -258,7 +259,9 @@ class CommonTest(GenericTest):
def test_abspath(self):
self.assertIn("foo", self.pathmodule.abspath("foo"))
- self.assertIn(b"foo", self.pathmodule.abspath(b"foo"))
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ self.assertIn(b"foo", self.pathmodule.abspath(b"foo"))
# Abspath returns bytes when the arg is bytes
for path in (b'', b'foo', b'f\xf2\xf2', b'/foo', b'C:\\'):
@@ -266,7 +269,9 @@ class CommonTest(GenericTest):
def test_realpath(self):
self.assertIn("foo", self.pathmodule.realpath("foo"))
- self.assertIn(b"foo", self.pathmodule.realpath(b"foo"))
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ self.assertIn(b"foo", self.pathmodule.realpath(b"foo"))
def test_normpath_issue5827(self):
# Make sure normpath preserves unicode
@@ -296,8 +301,10 @@ class CommonTest(GenericTest):
"Mac OS X denies the creation of a directory with an invalid utf8 name")
def test_nonascii_abspath(self):
# Test non-ASCII, non-UTF8 bytes in the path.
- with support.temp_cwd(b'\xe7w\xf0'):
- self.test_abspath()
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ with support.temp_cwd(b'\xe7w\xf0'):
+ self.test_abspath()
def test_main():