Skip to content

Commit 5fdbbcb

Browse files
committed
add unit test for create_args
1 parent 635c64e commit 5fdbbcb

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

test/test_podman.py renamed to test/test_container_engine.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
basic_project = test_projects.new_c_project()
88

99

10-
def test(tmp_path, capfd, request):
10+
def test_podman(tmp_path, capfd, request):
1111
if utils.platform != "linux":
1212
pytest.skip("the test is only relevant to the linux build")
1313

@@ -38,3 +38,29 @@ def test(tmp_path, capfd, request):
3838
# check that stdout is bring passed-though from container correctly
3939
captured = capfd.readouterr()
4040
assert "test log statement from before-all" in captured.out
41+
42+
43+
def test_create_args(tmp_path, capfd):
44+
if utils.platform != "linux":
45+
pytest.skip("the test is only relevant to the linux build")
46+
47+
project_dir = tmp_path / "project"
48+
basic_project.generate(project_dir)
49+
50+
# build a manylinux wheel, using create_args to set an environment variable
51+
actual_wheels = utils.cibuildwheel_run(
52+
project_dir,
53+
add_env={
54+
"CIBW_BUILD": "cp310-manylinux_*",
55+
"CIBW_BEFORE_ALL": "echo TEST_CREATE_ARGS is set to $TEST_CREATE_ARGS",
56+
"CIBW_CONTAINER_ENGINE": "docker; create_args: --env=TEST_CREATE_ARGS=itworks",
57+
},
58+
)
59+
60+
expected_wheels = [
61+
w for w in utils.expected_wheels("spam", "0.1.0") if ("cp310-manylinux" in w)
62+
]
63+
assert set(actual_wheels) == set(expected_wheels)
64+
65+
captured = capfd.readouterr()
66+
assert "TEST_CREATE_ARGS is set to itworks" in captured.out

0 commit comments

Comments
 (0)