diff options
Diffstat (limited to 'Lib/test/test_imp.py')
-rw-r--r-- | Lib/test/test_imp.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 432ca41..9fe8f43 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -179,6 +179,17 @@ class ImportTests(unittest.TestCase): self.assertRaises(SyntaxError, imp.find_module, "badsyntax_pep3120", [path]) + def test_load_dynamic_ImportError_path(self): + # Issue #1559549 added `name` and `path` attributes to ImportError + # in order to provide better detail. Issue #10854 implemented those + # attributes on import failures of extensions on Windows. + path = 'bogus file path' + name = 'extension' + with self.assertRaises(ImportError) as err: + imp.load_dynamic(name, path) + self.assertIn(path, err.exception.path) + self.assertEqual(name, err.exception.name) + class ReloadTests(unittest.TestCase): |