Files
cibuildwheel/test/test_docker_images.py
T

51 lines
1.5 KiB
Python
Raw Normal View History

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
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
# environment options CIBW_MANYLINUX1_*_IMAGE
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
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-05-03 11:45:43 -04:00
"CIBW_MANYLINUX_X86_64_IMAGE": "dockcross/manylinux2010-x64",
"CIBW_MANYLINUX_I686_IMAGE": "dockcross/manylinux2010-x86",
"CIBW_SKIP": "pp* cp27-* cp39-*",
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 = [
w
2021-05-03 11:45:43 -04:00
for w in utils.expected_wheels("spam", "0.1.0")
if "-pp" not in w and "-cp39-" not in w and "-cp27-" not 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)