Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit75401fe

Browse files
authored
gh-123930: Correct test of attribute failure to account for iOS (#125959)
Update a test of importing attributes from binary modules to account for iOS conditions.
1 parent2513593 commit75401fe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎Lib/test/test_import/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,14 @@ def test_from_import_missing_attr_has_name_and_so_path(self):
370370
from_testcapiimporti_dont_exist
371371
self.assertEqual(cm.exception.name,'_testcapi')
372372
ifhasattr(_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)
374378
self.assertRegex(
375379
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))?\)"
377381
)
378382
else:
379383
self.assertEqual(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp