* fix: enforce minimum version of docker/podman This allows to always pass `--platform` to the OCI engine thus fixing issues with multiarch images. * Allow older versions with warnings * Upgrade docker on Travis CI * fix: use `docker cp` instead of `tar` * Enforce docker>=24.0 * move log to include container.copy_into * fix: travis-ci, only update docker on aarch64 * skip test_multiarch_image on s390x / ppc64le * skip flaky test * chore: only install test deps on Travis CI * fix: do not try to pull images tagged `cibw_local` * use "--pull=never" for local images * Use docker image inspect to check if an image needs to be pulled
65 lines
2.1 KiB
Python
65 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from . import test_projects, utils
|
|
|
|
basic_project = test_projects.new_c_project()
|
|
|
|
|
|
def test_podman(tmp_path, capfd, request):
|
|
if utils.platform != "linux":
|
|
pytest.skip("the test is only relevant to the linux build")
|
|
|
|
if not request.config.getoption("--run-podman"):
|
|
pytest.skip("needs --run-podman option to run")
|
|
|
|
project_dir = tmp_path / "project"
|
|
basic_project.generate(project_dir)
|
|
|
|
# build some musllinux and manylinux wheels (ensuring that we use two containers)
|
|
actual_wheels = utils.cibuildwheel_run(
|
|
project_dir,
|
|
add_env={
|
|
"CIBW_ARCHS": "native",
|
|
"CIBW_BEFORE_ALL": "echo 'test log statement from before-all'",
|
|
"CIBW_CONTAINER_ENGINE": "podman",
|
|
},
|
|
single_python=True,
|
|
)
|
|
|
|
# check that the expected wheels are produced
|
|
expected_wheels = utils.expected_wheels("spam", "0.1.0", single_python=True, single_arch=True)
|
|
assert set(actual_wheels) == set(expected_wheels)
|
|
|
|
# check that stdout is bring passed-though from container correctly
|
|
captured = capfd.readouterr()
|
|
assert "test log statement from before-all" in captured.out
|
|
|
|
|
|
def test_create_args(tmp_path, capfd):
|
|
if utils.platform != "linux":
|
|
pytest.skip("the test is only relevant to the linux build")
|
|
|
|
project_dir = tmp_path / "project"
|
|
basic_project.generate(project_dir)
|
|
|
|
# build a manylinux wheel, using create_args to set an environment variable
|
|
actual_wheels = utils.cibuildwheel_run(
|
|
project_dir,
|
|
add_env={
|
|
"CIBW_SKIP": "*-musllinux_*",
|
|
"CIBW_BEFORE_ALL": "echo TEST_CREATE_ARGS is set to $TEST_CREATE_ARGS",
|
|
"CIBW_CONTAINER_ENGINE": "docker; create_args: --env=TEST_CREATE_ARGS=itworks",
|
|
},
|
|
single_python=True,
|
|
)
|
|
|
|
expected_wheels = utils.expected_wheels(
|
|
"spam", "0.1.0", musllinux_versions=[], single_python=True
|
|
)
|
|
assert set(actual_wheels) == set(expected_wheels)
|
|
|
|
captured = capfd.readouterr()
|
|
assert "TEST_CREATE_ARGS is set to itworks" in captured.out
|