forked from pypa/cibuildwheel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_container_images.py
51 lines (42 loc) · 1.55 KB
/
test_container_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import platform
import textwrap
import pytest
from . import test_projects, utils
dockcross_only_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
r"""
import os
# 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?"
)
"""
)
)
@pytest.mark.usefixtures("docker_cleanup")
def test(tmp_path):
if utils.platform != "linux":
pytest.skip("the test is only relevant to the linux build")
if platform.machine() not in ["x86_64", "i686"]:
pytest.skip(
"this test is currently only possible on x86_64/i686 due to availability of alternative images"
)
project_dir = tmp_path / "project"
dockcross_only_project.generate(project_dir)
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_MANYLINUX_X86_64_IMAGE": "dockcross/manylinux2014-x64",
"CIBW_MANYLINUX_I686_IMAGE": "dockcross/manylinux2014-x86",
"CIBW_BUILD": "cp3{8,9}-manylinux*",
},
)
# also check that we got the right wheels built
expected_wheels = [
w
for w in utils.expected_wheels("spam", "0.1.0", musllinux_versions=[])
if "-cp38-" in w or "-cp39-" in w
]
assert set(actual_wheels) == set(expected_wheels)