Skip to content

Commit 6fde293

Browse files
gpsheadned-deily
andauthored
[3.7] fix CI on macOS due to infrastructure changes (GH-96493)
* Add ABI and generated files checks to CI. This includes checking in an initial Abigail ABI definition for 3.7. * Backport ctypes test_macholib fix from b29d0a5. This is required for the 3.7 tree to pass on modern macOS. * annotate test_bad_password @requires_zlib. I don't know why, but macOS in 3.7 CI is failing to build the zlib module these days so it's exposing this test that didn't have the proper `@requires_zlib` annotation. Getting it to build with zlib and other things that are now wrongly "missing" in the 3.7 CI setup would be nice, but probably involves invasive backporting of parts of b29d0a5 by a macOS domain expert. Not worth it. * disable MachOTest.test_find unless macOS 11+ support is backported. This test also appears to require changes to Lib/ctypes/macholib/dyld.py to work in the existing macOS CI config. I'm just skipping it, backporting that would be a feature. Not going to happen in 3.7. There may be a way to configure macOS CI to use an older macOS and toolchain instead as an alternate option. Someone else can figure that out if so. This branch only lives for another 9 months per https://peps.python.org/pep-0537/ * LOL at my typo Co-authored-by: Ned Deily <[email protected]>
1 parent 9d58933 commit 6fde293

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

Lib/ctypes/test/test_macholib.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
# -bob
3333

3434
from ctypes.macholib.dyld import dyld_find
35+
try:
36+
from _ctypes import _dyld_shared_cache_contains_path
37+
except ImportError:
38+
_dyld_shared_cache_contains_path = None
3539

3640
def find_lib(name):
3741
possible = ['lib'+name+'.dylib', name+'.dylib', name+'.framework/'+name]
@@ -44,20 +48,24 @@ def find_lib(name):
4448

4549
class MachOTest(unittest.TestCase):
4650
@unittest.skipUnless(sys.platform == "darwin", 'OSX-specific test')
51+
@unittest.skipUnless(_dyld_shared_cache_contains_path, 'macOS 11+ _ctypes support not present.')
4752
def test_find(self):
48-
49-
self.assertEqual(find_lib('pthread'),
50-
'/usr/lib/libSystem.B.dylib')
53+
# On Mac OS 11, system dylibs are only present in the shared cache,
54+
# so symlinks like libpthread.dylib -> libSystem.B.dylib will not
55+
# be resolved by dyld_find
56+
self.assertIn(find_lib('pthread'),
57+
('/usr/lib/libSystem.B.dylib', '/usr/lib/libpthread.dylib'))
5158

5259
result = find_lib('z')
5360
# Issue #21093: dyld default search path includes $HOME/lib and
5461
# /usr/local/lib before /usr/lib, which caused test failures if
5562
# a local copy of libz exists in one of them. Now ignore the head
5663
# of the path.
57-
self.assertRegex(result, r".*/lib/libz\..*.*\.dylib")
64+
self.assertRegex(result, r".*/lib/libz.*\.dylib")
5865

59-
self.assertEqual(find_lib('IOKit'),
60-
'/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit')
66+
self.assertIn(find_lib('IOKit'),
67+
('/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit',
68+
'/System/Library/Frameworks/IOKit.framework/IOKit'))
6169

6270
if __name__ == "__main__":
6371
unittest.main()

Lib/test/test_zipfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,7 @@ def test_no_password(self):
20772077
self.assertRaises(RuntimeError, self.zip.read, "test.txt")
20782078
self.assertRaises(RuntimeError, self.zip2.read, "zero")
20792079

2080+
@requires_zlib
20802081
def test_bad_password(self):
20812082
self.zip.setpassword(b"perl")
20822083
self.assertRaises(RuntimeError, self.zip.read, "test.txt")

0 commit comments

Comments
 (0)