Repository navigation
test(tags): make the test suite pass on musl/Alpine (#850) - #1226
Merged
Merged
Conversation
Contributor
|
Should we add a musl job? (Edit: #1227) |
henryiii
approved these changes
Jun 6, 2026
The manylinux platform tests assert exact platform-tag lists and don't expect musllinux_* entries. On a musl host (Alpine) _get_musl_version() returns a real version, so musllinux_* tags leak into _linux_platforms() / sys_tags() and break the assertions. Neutralize musl detection by default in TestManylinuxPlatform and TestSysTags via a shared fixture (test_linux_platforms_musllinux re-patches _get_musl_version itself). test_is_manylinux_compatible_old is guarded only by a Linux-only skip, but musl is Linux; with no glibc _is_compatible() returns False and the assertion fails. Skip it when glibc is absent (uncached probe, so the marker doesn't populate the _get_glibc_version cache at collection time).
henryiii
force-pushed
the
test-musl-alpine-isolation-850
branch
from
June 6, 2026 05:22
2b9f008 to
ccf360c
Compare
henryiii
added a commit
to henryiii/packaging
that referenced
this pull request
Jun 7, 2026
Run the test suite inside an Alpine container so the musllinux tag detection code paths are exercised on a genuinely musl-linked Python. This provides coverage for the musl/Alpine fixes in pypa#1226. Assisted-by: ClaudeCode:claude-opus-4.8
henryiii
added a commit
that referenced
this pull request
Jun 7, 2026
Run the test suite inside an Alpine container so the musllinux tag detection code paths are exercised on a genuinely musl-linked Python. This provides coverage for the musl/Alpine fixes in #1226. Assisted-by: ClaudeCode:claude-opus-4.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the test-suite failures on musl/Alpine reported in #850.
Two independent issues:
_linux_platforms()assertions leak musllinux tags.TestManylinuxPlatform/TestSysTagsmonkeypatch manylinux/glibc detection and assert exact tag lists with nomusllinux_*entries. On a musl host_get_musl_version()returns a real version, so musllinux tags get appended and the==assertions fail. This adds a small shared fixture (applied to both classes viausefixtures) that neutralizes musl detection by default, mirroring the existingmonkeypatch.setattr(tags._musllinux, "_get_musl_version", ...)idiom.test_linux_platforms_musllinuxre-patches it itself, so it is unaffected.test_is_manylinux_compatible_oldasserts glibc under a Linux-only skip. musl is Linux, but with no glibc_get_glibc_version()returns the(-1, -1)sentinel and_is_compatible("any", _GLibCVersion(2, 0))isFalse, so the bare assert fails. The skip is extended to also skip when glibc is absent. It uses the uncached_glibc_version_string()rather than the cached_get_glibc_version()so the marker does not populate thelru_cacheat collection time.Verified locally: simulating a musl host turns 19 of these into failures on
main; with the patch they pass, and the normal (glibc/non-musl) run is unchanged.@brettcannon noted on #850 that it might be worth centralizing the monkeypatching — I kept this minimal and scoped to the two affected classes, but happy to fold it into a broader fixture refactor if you prefer.