Skip to content

Commit d7028f6

Browse files
committed
Add separate test for {project} placeholder in repair-wheel-command
1 parent 4e32536 commit d7028f6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/test_custom_repair_wheel.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,37 @@ def test(tmp_path, capfd):
3939
pytest.raises(subprocess.CalledProcessError) if num_builds > 1 else does_not_raise()
4040
)
4141

42+
with expectation as exc_info:
43+
result = utils.cibuildwheel_run(
44+
project_dir,
45+
add_env={
46+
"CIBW_REPAIR_WHEEL_COMMAND": "python repair.py {wheel} {dest_dir}",
47+
},
48+
)
49+
50+
captured = capfd.readouterr()
51+
if num_builds > 1:
52+
assert exc_info is not None
53+
assert "Build failed because a wheel named" in captured.err
54+
assert exc_info.value.returncode == 6
55+
else:
56+
# We only produced one wheel (perhaps Pyodide)
57+
# check that it has the right name
58+
assert result[0].startswith("spam-0.1.0-py2-none-")
59+
60+
61+
def test_project_placeholder(tmp_path, capfd):
62+
# Identical to the previous test with the additional assumption that the {project}
63+
# placeholder has been replaced correctly
64+
65+
project_dir = tmp_path / "project"
66+
basic_project.generate(project_dir)
67+
68+
num_builds = len(utils.cibuildwheel_get_build_identifiers(project_dir))
69+
expectation = (
70+
pytest.raises(subprocess.CalledProcessError) if num_builds > 1 else does_not_raise()
71+
)
72+
4273
with expectation as exc_info:
4374
result = utils.cibuildwheel_run(
4475
project_dir,

0 commit comments

Comments
 (0)