Files
cibuildwheel/test/test_build_frontend_args.py
T
Joe RickerbyandHenry Schreiner a2f965f62f Add an integration test and debug issues with the meson backend (#2718)
* Add an integration test with the meson backend

* Modify script to allow testing of the GHA action on a PR

* Try adding cython to languages in meson config

* Revert "Try adding cython to languages in meson config"

This reverts commit 50378a1c7e38665492ad0c683b178e4d96928e1e.

* Pass --vsenv to meson on windows

As seen here https://github.com/matplotlib/matplotlib/blob/9957c394bd01deb7a9bd9cb27804f447a52dc522/.github/workflows/cibuildwheel.yml#L114

* Disable win32 builds for the meson test

* Move the windows-specific config into the test project definition

This is so it can be tested with bin/run_example_ci_configs.py

* Add some docs to the FAQ about meson on windows

* Update bin/run_example_ci_configs.py

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2026-02-08 10:36:47 +00:00

40 lines
1.3 KiB
Python

import subprocess
import pytest
from . import test_projects, utils
@pytest.mark.parametrize(
"frontend_name",
[
pytest.param("pip", marks=utils.skip_if_pyodide("No pip for pyodide")),
"build",
],
)
def test_build_frontend_args(tmp_path, capfd, frontend_name):
project = test_projects.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
add_env = {"CIBW_BUILD_FRONTEND": f"{frontend_name}; args: -h"}
if utils.get_platform() == "pyodide":
add_env["TERM"] = "dumb" # disable color / style
add_env["NO_COLOR"] = "1"
with pytest.raises(subprocess.CalledProcessError):
utils.cibuildwheel_run(project_dir, add_env=add_env, single_python=True)
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
elif utils.get_platform() == "pyodide":
assert "Usage: pyodide build" in captured.out
else:
assert "usage:" in captured.out
assert "A simple, correct Python build frontend." in captured.out