summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-08-13 13:07:29 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-08-13 13:07:29 (GMT)
commit1a4d12d74681d35a40474790925a8ec9c8069b4e (patch)
tree8c23c387f6a2d179acefad150f8711111c468a7c /Lib
parent3d85a6fa043ddab8b289ccf5fb507242d45d2c28 (diff)
downloadcpython-1a4d12d74681d35a40474790925a8ec9c8069b4e.zip
cpython-1a4d12d74681d35a40474790925a8ec9c8069b4e.tar.gz
cpython-1a4d12d74681d35a40474790925a8ec9c8069b4e.tar.bz2
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()
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_imp.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 6dd1e21..233d3da 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -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