from _testcapi import i_dont_exist
self.assertEqual(cm.exception.name, '_testcapi')
if hasattr(_testcapi, "__file__"):
- self.assertEqual(cm.exception.path, _testcapi.__file__)
+ # The path on the exception is strictly the spec origin, not the
+ # module's __file__. For most cases, these are the same; but on
+ # iOS, the Framework relocation process results in the exception
+ # being raised from the spec location.
+ self.assertEqual(cm.exception.path, _testcapi.__spec__.origin)
self.assertRegex(
str(cm.exception),
- r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|fwork|pyd)\)"
+ r"cannot import name 'i_dont_exist' from '_testcapi' \(.*(\.(so|pyd))?\)"
)
else:
self.assertEqual(