File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -370,10 +370,14 @@ def test_from_import_missing_attr_has_name_and_so_path(self):
370
370
from _testcapi import i_dont_exist
371
371
self .assertEqual (cm .exception .name , '_testcapi' )
372
372
if hasattr (_testcapi , "__file__" ):
373
- self .assertEqual (cm .exception .path , _testcapi .__file__ )
373
+ # The path on the exception is strictly the spec origin, not the
374
+ # module's __file__. For most cases, these are the same; but on
375
+ # iOS, the Framework relocation process results in the exception
376
+ # being raised from the spec location.
377
+ self .assertEqual (cm .exception .path , _testcapi .__spec__ .origin )
374
378
self .assertRegex (
375
379
str (cm .exception ),
376
- r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|fwork| pyd)\)"
380
+ r"cannot import name 'i_dont_exist' from '_testcapi' \(.*( \.(so|pyd))? \)"
377
381
)
378
382
else :
379
383
self .assertEqual (
You can’t perform that action at this time.
0 commit comments