diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-10-08 18:31:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-08 18:31:19 (GMT) |
commit | 27ac19cca2c639caaf6fedf3632fe6beb265f24f (patch) | |
tree | b6b00cc99b9ed8649429fc64274408bdc14f2b22 /Lib/ctypes/test | |
parent | aecf036738a404371303e770f4ce4fd9f7d43de7 (diff) | |
download | cpython-27ac19cca2c639caaf6fedf3632fe6beb265f24f.zip cpython-27ac19cca2c639caaf6fedf3632fe6beb265f24f.tar.gz cpython-27ac19cca2c639caaf6fedf3632fe6beb265f24f.tar.bz2 |
bpo-41976: Fix the fallback to gcc of ctypes.util.find_library when using gcc>9 (GH-22598)
Diffstat (limited to 'Lib/ctypes/test')
-rw-r--r-- | Lib/ctypes/test/test_find.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py index bfb6b42..4a8a382 100644 --- a/Lib/ctypes/test/test_find.py +++ b/Lib/ctypes/test/test_find.py @@ -1,4 +1,5 @@ import unittest +import unittest.mock import os.path import sys import test.support @@ -73,7 +74,7 @@ class Test_OpenGL_libs(unittest.TestCase): @unittest.skipUnless(sys.platform.startswith('linux'), 'Test only valid for Linux') -class LibPathFindTest(unittest.TestCase): +class FindLibraryLinux(unittest.TestCase): def test_find_on_libpath(self): import subprocess import tempfile @@ -112,6 +113,15 @@ class LibPathFindTest(unittest.TestCase): # LD_LIBRARY_PATH) self.assertEqual(find_library(libname), 'lib%s.so' % libname) + def test_find_library_with_gcc(self): + with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None): + self.assertNotEqual(find_library('c'), None) + + def test_find_library_with_ld(self): + with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \ + unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None): + self.assertNotEqual(find_library('c'), None) + if __name__ == "__main__": unittest.main() |