Skip to content

gh-151089: Improve mocking and skipping in test_ctypes/test_find.py#151231

Open
rossburton wants to merge 2 commits into
python:mainfrom
rossburton:ctypes
Open

gh-151089: Improve mocking and skipping in test_ctypes/test_find.py#151231
rossburton wants to merge 2 commits into
python:mainfrom
rossburton:ctypes

Conversation

@rossburton

@rossburton rossburton commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

test_find_library_with_gcc will pass if gcc isn't present as the mocking isn't complete, and when that is fixed the skipping isn't complete.

…brary_with_gcc()

ctypes.util.find_library() on POSIX will try ldconfig then gcc then ld.

test_find_library_with_gcc() mocks away just the use of ldconfig, so if
gcc isn't actually present on the machine (because the tests are being
ran on an installed system, for example) then it will happily fall back
to using ld, which makes a mockery (pun unintended) of the test case
name.

Also mock _findLib_ld to return None, so the test either uses gcc or
fails if it isn't present.
@bedevere-app bedevere-app Bot added awaiting review tests Tests in the Lib/test dir labels Jun 10, 2026
@rossburton rossburton changed the title gn-151089: Improve mocking and skipping in test_ctypes/test_find.py gh-151089: Improve mocking and skipping in test_ctypes/test_find.py Jun 10, 2026
…test_find.py

In FindLibraryLinux, check for gcc and ld in setUpClass and then skip
the tests that need those commands to be present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant