pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.11k stars 310 forks source link

`tests/backend/builders/test_wheel.py::TestBuildStandard` fail on musl, wrongly assuming `linux` tag #1634

Open mgorny opened 4 months ago

mgorny commented 4 months ago

When running the test suite on a musl system (as of 3adae6c0dfd5c20dfe9bf6bae19b44a696c22a43), I'm getting the following test failures (running only backend tests):

FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_known_artifacts - AssertionError: assert '/tmp/tmpak5t...ux_x86_64.whl' == '/tmp/tmpak5t..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_configured_build_hooks - AssertionError: assert '/tmp/tmpwgdf...ux_x86_64.whl' == '/tmp/tmpwgdf..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_extra_dependencies - AssertionError: assert '/tmp/tmpzgjf...ux_x86_64.whl' == '/tmp/tmpzgjf..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_dynamic_artifacts - AssertionError: assert '/tmp/tmpg_gz...ux_x86_64.whl' == '/tmp/tmpg_gz..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_dynamic_force_include - AssertionError: assert '/tmp/tmpaiuk...ux_x86_64.whl' == '/tmp/tmpaiuk..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_dynamic_force_include_duplicate - AssertionError: assert '/tmp/tmp9t9h...ux_x86_64.whl' == '/tmp/tmp9t9h..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_build_script_dynamic_artifacts_with_src_layout - AssertionError: assert '/tmp/tmpzbf1...ux_x86_64.whl' == '/tmp/tmpzbf1..._2_x86_64.whl'
FAILED tests/backend/builders/test_wheel.py::TestBuildStandard::test_default_symlink - AssertionError: assert '/tmp/tmpq186...ux_x86_64.whl' == '/tmp/tmpq186..._2_x86_64.whl'

In all cases, the tests are failing because they assume linux_x86_64 ABI tag, while they are getting musllinux_1_2_x86_64 instead, e.g.:

        best_matching_tag = next(sys_tags())
        tag = f'{best_matching_tag.interpreter}-{best_matching_tag.abi}-{best_matching_tag.platform}'
>       assert expected_artifact == str(build_path / f'{builder.project_id}-{tag}.whl')
E       AssertionError: assert '/tmp/tmpbjjn...ux_x86_64.whl' == '/tmp/tmpbjjn..._2_x86_64.whl'
E         
E         Skipping 44 identical leading characters in diff, use -v to show
E         - 312-cp312-musllinux_1_2_x86_64.whl
E         ?           ----     ----
E         + 312-cp312-linux_x86_64.whl

/home/mgorny2/hatch/tests/backend/builders/test_wheel.py:2457: AssertionError

I've reproduced this by creating a systemd-nspawn container and unpacking a Gentoo amd64 musl stage3 into it. Then, within the git checkout I've created a venv and installed:

pip install -e .
pip install -e backend
pip install pytest editables
pytest tests/backend

Original bug report: https://bugs.gentoo.org/935896