Repository navigation
gh-161870: Skip test_platform when a 32-bit build sees a different machine name - #161879
Open
sainimal1ba-hue wants to merge 2 commits into
Open
sainimal1ba-hue wants to merge 2 commits into
sainimal1ba-hue wants to merge 2 commits into
Conversation
…ent machine name The platform recorded in build-details.json describes the build machine, while sysconfig.get_platform() at test time reports the kernel's machine name, which can differ for a 32-bit process on a 64-bit kernel.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
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.
Issue: gh-161870
build-details.json records sysconfig.get_platform() from the build machine, and test_platform compared that value with the one computed at test time. On Linux, os.uname() reports the kernel's machine name, so for a 32-bit build the two can differ when the build machine and the test machine see the same architecture under different names: linux-i686 != linux-x86_64 for Debian i386 packages on an x86_64 kernel, linux-armv7l != linux-armv8l for Ubuntu armhf, and so on.
The recorded value describes the build and is not wrong, so this only relaxes the test: when the two platforms differ and the running interpreter is a 32-bit Linux build, the test now skips instead of failing. In every other case the comparison stays strict, including for a mismatch seen by a 64-bit build.
Testing (Linux x86_64, debug build):
./python -m test test_build_details test_sysconfig passes with the unmodified file, so the strict comparison still holds when the values match.
With the recorded platform changed to linux-i686, the old test fails with AssertionError: linux-i686 != linux-x86_64, the same pair reported in the issue. With this change the test skips for a 32-bit interpreter (simulated with sys.maxsize = 2**31 - 1, the same approach test_sysconfig uses) and still fails for a 64-bit one, where a mismatch is not expected.