Skip to content

Commit 80be2ab

Browse files
committed
Fix test failing on RHEL8
On that platform, libc is called libc-2.28.so, not libc.so. Instead, the test searches for libffi.so, which is a dependency of ctypes
1 parent 43ff300 commit 80be2ab

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/test/test_ctypes/test_dllist.py

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

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

2023
class ListSharedLibraries(unittest.TestCase):
2124

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

2528
self.assertIsNotNone(dlls)
2629
self.assertGreater(len(dlls), 0, f'loaded={dlls}')
27-
self.assertTrue(any(SYSTEM_LIBRARY in dll for dll in dlls), f'loaded={dlls}')
30+
self.assertTrue(any(KNOWN_LIBRARY in dll for dll in dlls), f'loaded={dlls}')
2831

2932

3033
def test_lists_updates(self):

0 commit comments

Comments
 (0)