2020-05-02 22:50:52 +01:00
|
|
|
import platform
|
|
|
|
|
import textwrap
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
2021-01-06 13:50:58 -05:00
|
|
|
from . import test_projects, utils
|
2020-05-02 16:54:19 +01:00
|
|
|
|
2020-05-17 16:54:33 +01:00
|
|
|
dockcross_only_project = test_projects.new_c_project(
|
2021-04-30 17:56:34 -04:00
|
|
|
setup_py_add=textwrap.dedent(
|
2021-05-03 11:45:43 -04:00
|
|
|
r"""
|
2021-02-18 08:15:37 +01:00
|
|
|
import os
|
2020-05-02 16:54:19 +01:00
|
|
|
|
|
|
|
|
# check that we're running in the correct docker image as specified in the
|
2025-03-22 17:26:38 +01:00
|
|
|
# environment options CIBW_MANYLINUX_*_IMAGE
|
2020-05-02 16:54:19 +01:00
|
|
|
if "linux" in sys.platform and not os.path.exists("/dockcross"):
|
|
|
|
|
raise Exception(
|
|
|
|
|
"/dockcross directory not found. Is this test running in the correct docker image?"
|
|
|
|
|
)
|
2021-05-03 11:45:43 -04:00
|
|
|
"""
|
2021-04-30 17:56:34 -04:00
|
|
|
)
|
2020-05-02 16:54:19 +01:00
|
|
|
)
|
|
|
|
|
|
2020-05-02 22:50:52 +01:00
|
|
|
|
2023-08-07 18:01:10 +02:00
|
|
|
@pytest.mark.usefixtures("docker_cleanup")
|
2020-05-03 14:08:57 +01:00
|
|
|
def test(tmp_path):
|
2021-05-03 11:45:43 -04:00
|
|
|
if utils.platform != "linux":
|
|
|
|
|
pytest.skip("the test is only relevant to the linux build")
|
|
|
|
|
if platform.machine() not in ["x86_64", "i686"]:
|
2021-04-30 17:56:34 -04:00
|
|
|
pytest.skip(
|
2021-05-03 11:45:43 -04:00
|
|
|
"this test is currently only possible on x86_64/i686 due to availability of alternative images"
|
2021-04-30 17:56:34 -04:00
|
|
|
)
|
2020-05-02 16:54:19 +01:00
|
|
|
|
2021-05-03 11:45:43 -04:00
|
|
|
project_dir = tmp_path / "project"
|
2020-05-02 16:54:19 +01:00
|
|
|
dockcross_only_project.generate(project_dir)
|
|
|
|
|
|
2021-04-30 17:56:34 -04:00
|
|
|
actual_wheels = utils.cibuildwheel_run(
|
|
|
|
|
project_dir,
|
|
|
|
|
add_env={
|
2021-11-20 17:51:57 +00:00
|
|
|
"CIBW_MANYLINUX_X86_64_IMAGE": "dockcross/manylinux2014-x64",
|
|
|
|
|
"CIBW_MANYLINUX_I686_IMAGE": "dockcross/manylinux2014-x86",
|
2025-02-25 20:23:01 +01:00
|
|
|
"CIBW_BUILD": "cp3{8,9}-manylinux*",
|
2021-04-30 17:56:34 -04:00
|
|
|
},
|
|
|
|
|
)
|
2020-05-02 16:54:19 +01:00
|
|
|
|
|
|
|
|
# also check that we got the right wheels built
|
2021-04-30 17:56:34 -04:00
|
|
|
expected_wheels = [
|
2021-04-03 16:59:10 +02:00
|
|
|
w
|
2021-09-20 08:12:35 +02:00
|
|
|
for w in utils.expected_wheels("spam", "0.1.0", musllinux_versions=[])
|
2025-02-25 20:23:01 +01:00
|
|
|
if "-cp38-" in w or "-cp39-" in w
|
2021-04-30 17:56:34 -04:00
|
|
|
]
|
2020-05-02 16:54:19 +01:00
|
|
|
assert set(actual_wheels) == set(expected_wheels)
|