summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-09-08 18:11:13 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-09-08 18:11:13 (GMT)
commite58571b7eaa3f282d7d29f3aead1cc8220bec473 (patch)
treee43f9fd886b42d92ec4d6c544fe83e91eb6f27e8 /Lib/test
parentee178e6d6ebcf28da8696c853cc9de5e3c0f15b4 (diff)
downloadcpython-e58571b7eaa3f282d7d29f3aead1cc8220bec473.zip
cpython-e58571b7eaa3f282d7d29f3aead1cc8220bec473.tar.gz
cpython-e58571b7eaa3f282d7d29f3aead1cc8220bec473.tar.bz2
Fixes tests broken by issue #27781.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_genericpath.py5
-rw-r--r--Lib/test/test_httpservers.py2
-rw-r--r--Lib/test/test_shutil.py4
-rw-r--r--Lib/test/test_sys.py5
4 files changed, 10 insertions, 6 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index c8f158d..ae5dd6a 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -388,10 +388,13 @@ class CommonTest(GenericTest):
warnings.simplefilter("ignore", DeprecationWarning)
self.assertIn(b"foo", self.pathmodule.abspath(b"foo"))
+ # avoid UnicodeDecodeError on Windows
+ undecodable_path = b'' if sys.platform == 'win32' else b'f\xf2\xf2'
+
# Abspath returns bytes when the arg is bytes
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
- for path in (b'', b'foo', b'f\xf2\xf2', b'/foo', b'C:\\'):
+ for path in (b'', b'foo', undecodable_path, b'/foo', b'C:\\'):
self.assertIsInstance(self.pathmodule.abspath(path), bytes)
def test_realpath(self):
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 75044cb..4e93144 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -370,6 +370,8 @@ class SimpleHTTPServerTestCase(BaseTestCase):
return body
@support.requires_mac_ver(10, 5)
+ @unittest.skipIf(sys.platform == 'win32',
+ 'undecodable name cannot be decoded on win32')
@unittest.skipUnless(support.TESTFN_UNDECODABLE,
'need support.TESTFN_UNDECODABLE')
def test_undecodable_filename(self):
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 90a31d7..990fae5 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -132,9 +132,7 @@ class TestShutil(unittest.TestCase):
write_file(os.path.join(victim, 'somefile'), 'foo')
victim = os.fsencode(victim)
self.assertIsInstance(victim, bytes)
- win = (os.name == 'nt')
- with self.assertWarns(DeprecationWarning) if win else ExitStack():
- shutil.rmtree(victim)
+ shutil.rmtree(victim)
@support.skip_unless_symlink
def test_rmtree_fails_on_symlink(self):
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index ea152c1..6084d2d 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -10,6 +10,7 @@ import codecs
import gc
import sysconfig
import platform
+import locale
# count the number of test runs, used to create unique
# strings to intern in test_intern()
@@ -627,6 +628,8 @@ class SysModuleTest(unittest.TestCase):
@unittest.skipUnless(test.support.FS_NONASCII,
'requires OS support of non-ASCII encodings')
+ @unittest.skipUnless(sys.getfilesystemencoding() == locale.getpreferredencoding(False),
+ 'requires FS encoding to match locale')
def test_ioencoding_nonascii(self):
env = dict(os.environ)
@@ -669,8 +672,6 @@ class SysModuleTest(unittest.TestCase):
fs_encoding = sys.getfilesystemencoding()
if sys.platform == 'darwin':
expected = 'utf-8'
- elif sys.platform == 'win32':
- expected = 'mbcs'
else:
expected = None
self.check_fsencoding(fs_encoding, expected)