Test enable groups as specified by PR labels (#2357)

* Allow CIBW_ENABLE to control the wheels built in testing

* Set CIBW_ENABLE using PR labels

* Add docs

* Build everything on the main branch

* Add CIBW_ENABLE=all option

This was mostly for use in the `main` building case, because otherwise it's maybe a bit too easy to forget to update this file when adding an enable group

* Remove dead code

* Make unit tests robust to the value of CIBW_ENABLE

* Fix tests that explicitly choose pypy

* Fix test expectation

* Don't expect impossible wheels in expected_wheels

* Simplify logic in expected_wheels

* CircleCI- run with CIBW_ENABLE=all only on the main branch

* Azure pipelines - run with CIBW_ENABLE=all on main branch

* Update gitlab to run CIBW_ENABLE=all on main

* Set CIBW_ENABLE=all on travis - it only runs on main anyway

* Fix job name error on CircleCI

* Fix tests for graalpy

* Update the test configuration to use the label

* Remove duplication of default value. Make it affect sample build too

* Move the action to after deps are installed

* GraalPy workaround for this assumption

* Make unit test resilient to changing CIBW_ENABLE
This commit is contained in:
Joe Rickerby
2025-05-08 12:27:05 +01:00
committed by GitHub
parent edbd234b82
commit 04c9427a20
15 changed files with 204 additions and 82 deletions
+12
View File
@@ -329,6 +329,7 @@ def test_config_settings(platform_specific, platform, intercepted_build_args, mo
@pytest.mark.usefixtures("platform", "intercepted_build_args", "allow_empty")
def test_build_selector_deprecated_error(monkeypatch, selector, pattern, capsys):
monkeypatch.setenv(selector, pattern)
monkeypatch.delenv("CIBW_ENABLE", raising=False)
if selector == "CIBW_BUILD":
with pytest.raises(SystemExit) as ex:
@@ -422,6 +423,8 @@ def test_debug_traceback(monkeypatch, method, capfd):
@pytest.mark.parametrize("method", ["unset", "command_line", "env_var"])
def test_enable(method, intercepted_build_args, monkeypatch):
monkeypatch.delenv("CIBW_ENABLE", raising=False)
if method == "command_line":
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "pypy", "--enable", "graalpy"])
elif method == "env_var":
@@ -437,6 +440,15 @@ def test_enable(method, intercepted_build_args, monkeypatch):
assert enable_groups == frozenset([EnableGroup.PyPy, EnableGroup.GraalPy])
def test_enable_all(intercepted_build_args, monkeypatch):
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "all"])
main()
enable_groups = intercepted_build_args.args[0].globals.build_selector.enable
assert enable_groups == EnableGroup.all_groups()
def test_enable_arg_inherits(intercepted_build_args, monkeypatch):
monkeypatch.setenv("CIBW_ENABLE", "pypy graalpy")
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "cpython-prerelease"])