mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #9425: NullImporter constructor is fully unicode compliant
* On non-Windows OSes: the constructor accepts bytes filenames and use surrogateescape for unicode filenames * On Windows: use GetFileAttributesW() instead of GetFileAttributesA()
This commit is contained in:
parent
3d85a6fa04
commit
1a4d12d746
2 changed files with 68 additions and 41 deletions
|
@ -306,11 +306,24 @@ class PEP3147Tests(unittest.TestCase):
|
|||
os.sep.join(('.', 'pep3147', '__init__.py')))
|
||||
|
||||
|
||||
class NullImporterTests(unittest.TestCase):
|
||||
@unittest.skipIf(support.TESTFN_UNENCODEABLE is None,
|
||||
"Need an undecodeable filename")
|
||||
def test_unencodeable(self):
|
||||
name = support.TESTFN_UNENCODEABLE
|
||||
os.mkdir(name)
|
||||
try:
|
||||
self.assertRaises(ImportError, imp.NullImporter, name)
|
||||
finally:
|
||||
os.rmdir(name)
|
||||
|
||||
|
||||
def test_main():
|
||||
tests = [
|
||||
ImportTests,
|
||||
PEP3147Tests,
|
||||
ReloadTests,
|
||||
NullImporterTests,
|
||||
]
|
||||
try:
|
||||
import _thread
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue