Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ def test_from_import_missing_attr_has_name_and_path(self):
self.assertEqual(cm.exception.path, os.__file__)
self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from 'os' \(.*os.py\)")

@cpython_only
def test_from_import_missing_attr_has_name_and_so_path(self):
import select
import _testcapi
with self.assertRaises(ImportError) as cm:
from select import i_dont_exist
self.assertEqual(cm.exception.name, 'select')
self.assertEqual(cm.exception.path, select.__file__)
self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from 'select' \(.*\.(so|pyd)\)")
from _testcapi import i_dont_exist
self.assertEqual(cm.exception.name, '_testcapi')
self.assertEqual(cm.exception.path, _testcapi.__file__)
self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|pyd)\)")

def test_from_import_missing_attr_has_name(self):
with self.assertRaises(ImportError) as cm:
Expand Down