summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2022-09-01 20:46:48 -0700
committerGitHub <noreply@github.com>2022-09-01 23:46:48 -0400
commit6fde29377fd57fea13a54dd847b7cf171c2df6d1 (patch)
treeb64264aa94edc13e41afb10368fc0f00b97cd052
parent9d58933c20cd49c9a78d54483f27add6cb18138d (diff)
downloadcpython-git-6fde29377fd57fea13a54dd847b7cf171c2df6d1.tar.gz
[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 b29d0a5a7811418c0a1082ca188fd4850185e290. 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 https://github.com/python/cpython/commit/b29d0a5a7811418c0a1082ca188fd4850185e290 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 <nad@python.org>
-rw-r--r--Lib/ctypes/test/test_macholib.py20
-rw-r--r--Lib/test/test_zipfile.py1
2 files changed, 15 insertions, 6 deletions
diff --git a/Lib/ctypes/test/test_macholib.py b/Lib/ctypes/test/test_macholib.py
index 6b3526951a..8b13b3af22 100644
--- a/Lib/ctypes/test/test_macholib.py
+++ b/Lib/ctypes/test/test_macholib.py
@@ -32,6 +32,10 @@ import unittest
# -bob
from ctypes.macholib.dyld import dyld_find
+try:
+ from _ctypes import _dyld_shared_cache_contains_path
+except ImportError:
+ _dyld_shared_cache_contains_path = None
def find_lib(name):
possible = ['lib'+name+'.dylib', name+'.dylib', name+'.framework/'+name]
@@ -44,20 +48,24 @@ def find_lib(name):
class MachOTest(unittest.TestCase):
@unittest.skipUnless(sys.platform == "darwin", 'OSX-specific test')
+ @unittest.skipUnless(_dyld_shared_cache_contains_path, 'macOS 11+ _ctypes support not present.')
def test_find(self):
-
- self.assertEqual(find_lib('pthread'),
- '/usr/lib/libSystem.B.dylib')
+ # On Mac OS 11, system dylibs are only present in the shared cache,
+ # so symlinks like libpthread.dylib -> libSystem.B.dylib will not
+ # be resolved by dyld_find
+ self.assertIn(find_lib('pthread'),
+ ('/usr/lib/libSystem.B.dylib', '/usr/lib/libpthread.dylib'))
result = find_lib('z')
# Issue #21093: dyld default search path includes $HOME/lib and
# /usr/local/lib before /usr/lib, which caused test failures if
# a local copy of libz exists in one of them. Now ignore the head
# of the path.
- self.assertRegex(result, r".*/lib/libz\..*.*\.dylib")
+ self.assertRegex(result, r".*/lib/libz.*\.dylib")
- self.assertEqual(find_lib('IOKit'),
- '/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit')
+ self.assertIn(find_lib('IOKit'),
+ ('/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit',
+ '/System/Library/Frameworks/IOKit.framework/IOKit'))
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 7e8e8d2c89..6a6df85985 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -2077,6 +2077,7 @@ class DecryptionTests(unittest.TestCase):
self.assertRaises(RuntimeError, self.zip.read, "test.txt")
self.assertRaises(RuntimeError, self.zip2.read, "zero")
+ @requires_zlib
def test_bad_password(self):
self.zip.setpassword(b"perl")
self.assertRaises(RuntimeError, self.zip.read, "test.txt")