Files
cibuildwheel/test/test_build_frontend_args.py
T

33 lines
999 B
Python
Raw Normal View History

2023-08-26 19:37:29 +01:00
import subprocess
import pytest
from . import utils
from .test_projects.c import new_c_project
@pytest.mark.parametrize("frontend_name", ["pip", "build"])
def test_build_frontend_args(tmp_path, capfd, frontend_name):
project = new_c_project()
project_dir = tmp_path / "project"
project.generate(project_dir)
# the build will fail because the frontend is called with '-h' - it prints the help message
with pytest.raises(subprocess.CalledProcessError):
utils.cibuildwheel_run(
project_dir,
2024-05-26 12:41:20 +02:00
add_env={"CIBW_BUILD_FRONTEND": f"{frontend_name}; args: -h"},
single_python=True,
2023-08-26 19:37:29 +01:00
)
captured = capfd.readouterr()
print(captured.out)
# check that the help message was printed
if frontend_name == "pip":
assert "Usage:" in captured.out
assert "Wheel Options:" in captured.out
else:
assert "usage:" in captured.out
assert "A simple, correct Python build frontend." in captured.out