mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
[3.13] gh-123930: Correct test of attribute failure to account for iOS (GH-125959) (#125960)
gh-123930: Correct test of attribute failure to account for iOS (GH-125959)
Update a test of importing attributes from binary modules to account for iOS conditions.
(cherry picked from commit 75401febc9
)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
This commit is contained in:
parent
32830cf703
commit
b67358125c
1 changed files with 6 additions and 2 deletions
|
@ -389,10 +389,14 @@ class ImportTests(unittest.TestCase):
|
|||
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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue