(original) (raw)

changeset: 103329:faca0730270b user: Steve Dower steve.dower@microsoft.com date: Thu Sep 08 11:11:13 2016 -0700 files: Lib/test/test_genericpath.py Lib/test/test_httpservers.py Lib/test/test_shutil.py Lib/test/test_sys.py description: Fixes tests broken by issue #27781. diff -r 7eda9b57531d -r faca0730270b Lib/test/test_genericpath.py --- a/Lib/test/test_genericpath.py Thu Sep 08 11:08:30 2016 -0700 +++ b/Lib/test/test_genericpath.py Thu Sep 08 11:11:13 2016 -0700 @@ -388,10 +388,13 @@ 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 -r 7eda9b57531d -r faca0730270b Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py Thu Sep 08 11:08:30 2016 -0700 +++ b/Lib/test/test_httpservers.py Thu Sep 08 11:11:13 2016 -0700 @@ -370,6 +370,8 @@ 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 -r 7eda9b57531d -r faca0730270b Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py Thu Sep 08 11:08:30 2016 -0700 +++ b/Lib/test/test_shutil.py Thu Sep 08 11:11:13 2016 -0700 @@ -132,9 +132,7 @@ 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 -r 7eda9b57531d -r faca0730270b Lib/test/test_sys.py --- a/Lib/test/test_sys.py Thu Sep 08 11:08:30 2016 -0700 +++ b/Lib/test/test_sys.py Thu Sep 08 11:11:13 2016 -0700 @@ -10,6 +10,7 @@ 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 @@ @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 @@ 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) /steve.dower@microsoft.com