mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #14599: Generalize a test for ImportError.path and add support
in Python/dynload_shlibs.c. This should fix the remaining importlib test failure on Windows. Support in AIX and HP-UX will be in a separate checkin.
This commit is contained in:
parent
3c23a87e58
commit
f0434e647a
4 changed files with 26 additions and 27 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue