Skip to content

Commit e1dae92

Browse files
committed
test_dllist: check for one of several known libraries
This should cover all tested systems, including Andriod which statically links libffi
1 parent 80be2ab commit e1dae92

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_ctypes/test_dllist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
APPLE = sys.platform in {"darwin", "ios", "tvos", "watchos"}
1212

1313
if WINDOWS:
14-
KNOWN_LIBRARY = 'KERNEL32.DLL'
14+
KNOWN_LIBRARIES = ['KERNEL32.DLL']
1515
elif APPLE:
16-
KNOWN_LIBRARY = 'libSystem.B.dylib'
16+
KNOWN_LIBRARIES = ['libSystem.B.dylib']
1717
else:
1818
# trickier than it seems, because libc may not be present
1919
# on musl systems, and sometimes goes by different names.
2020
# However, ctypes itself loads libffi
21-
KNOWN_LIBRARY = 'libffi.so'
21+
KNOWN_LIBRARIES = ['libc.so', 'libffi.so']
2222

2323
class ListSharedLibraries(unittest.TestCase):
2424

@@ -27,7 +27,7 @@ def test_lists_system(self):
2727

2828
self.assertIsNotNone(dlls)
2929
self.assertGreater(len(dlls), 0, f'loaded={dlls}')
30-
self.assertTrue(any(KNOWN_LIBRARY in dll for dll in dlls), f'loaded={dlls}')
30+
self.assertTrue(any(lib in dll for dll in dlls for lib in KNOWN_LIBRARIES), f'loaded={dlls}')
3131

3232

3333
def test_lists_updates(self):

0 commit comments

Comments
 (0)