Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_imp.py @ 63945:03e884fac4db
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()
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Fri, 13 Aug 2010 13:07:29 +0000 |
| parents | 726483d97b5c |
| children | 291c9afab12c |
line wrap: on
line diff
--- a/Lib/test/test_imp.py Fri Aug 13 13:02:04 2010 +0000 +++ b/Lib/test/test_imp.py Fri Aug 13 13:07:29 2010 +0000 @@ -306,11 +306,24 @@ 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
