mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fixes tests broken by issue #27781.
This commit is contained in:
parent
ee178e6d6e
commit
e58571b7ea
4 changed files with 10 additions and 6 deletions
|
@ -388,10 +388,13 @@ class CommonTest(GenericTest):
|
||||||
warnings.simplefilter("ignore", DeprecationWarning)
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
self.assertIn(b"foo", self.pathmodule.abspath(b"foo"))
|
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
|
# Abspath returns bytes when the arg is bytes
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore", DeprecationWarning)
|
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)
|
self.assertIsInstance(self.pathmodule.abspath(path), bytes)
|
||||||
|
|
||||||
def test_realpath(self):
|
def test_realpath(self):
|
||||||
|
|
|
@ -370,6 +370,8 @@ class SimpleHTTPServerTestCase(BaseTestCase):
|
||||||
return body
|
return body
|
||||||
|
|
||||||
@support.requires_mac_ver(10, 5)
|
@support.requires_mac_ver(10, 5)
|
||||||
|
@unittest.skipIf(sys.platform == 'win32',
|
||||||
|
'undecodable name cannot be decoded on win32')
|
||||||
@unittest.skipUnless(support.TESTFN_UNDECODABLE,
|
@unittest.skipUnless(support.TESTFN_UNDECODABLE,
|
||||||
'need support.TESTFN_UNDECODABLE')
|
'need support.TESTFN_UNDECODABLE')
|
||||||
def test_undecodable_filename(self):
|
def test_undecodable_filename(self):
|
||||||
|
|
|
@ -132,9 +132,7 @@ class TestShutil(unittest.TestCase):
|
||||||
write_file(os.path.join(victim, 'somefile'), 'foo')
|
write_file(os.path.join(victim, 'somefile'), 'foo')
|
||||||
victim = os.fsencode(victim)
|
victim = os.fsencode(victim)
|
||||||
self.assertIsInstance(victim, bytes)
|
self.assertIsInstance(victim, bytes)
|
||||||
win = (os.name == 'nt')
|
shutil.rmtree(victim)
|
||||||
with self.assertWarns(DeprecationWarning) if win else ExitStack():
|
|
||||||
shutil.rmtree(victim)
|
|
||||||
|
|
||||||
@support.skip_unless_symlink
|
@support.skip_unless_symlink
|
||||||
def test_rmtree_fails_on_symlink(self):
|
def test_rmtree_fails_on_symlink(self):
|
||||||
|
|
|
@ -10,6 +10,7 @@ import codecs
|
||||||
import gc
|
import gc
|
||||||
import sysconfig
|
import sysconfig
|
||||||
import platform
|
import platform
|
||||||
|
import locale
|
||||||
|
|
||||||
# count the number of test runs, used to create unique
|
# count the number of test runs, used to create unique
|
||||||
# strings to intern in test_intern()
|
# strings to intern in test_intern()
|
||||||
|
@ -627,6 +628,8 @@ class SysModuleTest(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipUnless(test.support.FS_NONASCII,
|
@unittest.skipUnless(test.support.FS_NONASCII,
|
||||||
'requires OS support of non-ASCII encodings')
|
'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):
|
def test_ioencoding_nonascii(self):
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
|
|
||||||
|
@ -669,8 +672,6 @@ class SysModuleTest(unittest.TestCase):
|
||||||
fs_encoding = sys.getfilesystemencoding()
|
fs_encoding = sys.getfilesystemencoding()
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
expected = 'utf-8'
|
expected = 'utf-8'
|
||||||
elif sys.platform == 'win32':
|
|
||||||
expected = 'mbcs'
|
|
||||||
else:
|
else:
|
||||||
expected = None
|
expected = None
|
||||||
self.check_fsencoding(fs_encoding, expected)
|
self.check_fsencoding(fs_encoding, expected)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue