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:
+16
-9
@@ -1,8 +1,10 @@
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
|
||||
from cibuildwheel.logger import Logger
|
||||
from cibuildwheel.selector import EnableGroup
|
||||
|
||||
from . import test_projects, utils
|
||||
|
||||
@@ -38,11 +40,13 @@ def test(tmp_path, build_frontend_env, capfd):
|
||||
expected_wheels = utils.expected_wheels("spam", "0.1.0")
|
||||
assert set(actual_wheels) == set(expected_wheels)
|
||||
|
||||
# Verify pip warning not shown
|
||||
captured = capfd.readouterr()
|
||||
for stream in (captured.err, captured.out):
|
||||
assert "WARNING: Running pip as the 'root' user can result" not in stream
|
||||
assert "A new release of pip available" not in stream
|
||||
enable_groups = EnableGroup.parse_option_value(os.environ.get("CIBW_ENABLE", ""))
|
||||
if EnableGroup.GraalPy not in enable_groups:
|
||||
# Verify pip warning not shown
|
||||
captured = capfd.readouterr()
|
||||
for stream in (captured.err, captured.out):
|
||||
assert "WARNING: Running pip as the 'root' user can result" not in stream
|
||||
assert "A new release of pip available" not in stream
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="to keep test output clean")
|
||||
@@ -61,16 +65,19 @@ def test_sample_build(tmp_path, capfd):
|
||||
logger.step_end()
|
||||
|
||||
|
||||
def test_build_identifiers(tmp_path):
|
||||
@pytest.mark.parametrize(
|
||||
"enable_setting", ["", "cpython-prerelease", "pypy", "cpython-freethreading"]
|
||||
)
|
||||
def test_build_identifiers(tmp_path, enable_setting, monkeypatch):
|
||||
project_dir = tmp_path / "project"
|
||||
basic_project.generate(project_dir)
|
||||
|
||||
monkeypatch.setenv("CIBW_ENABLE", enable_setting)
|
||||
|
||||
# check that the number of expected wheels matches the number of build
|
||||
# identifiers
|
||||
expected_wheels = utils.expected_wheels("spam", "0.1.0")
|
||||
build_identifiers = utils.cibuildwheel_get_build_identifiers(
|
||||
project_dir, prerelease_pythons=True
|
||||
)
|
||||
build_identifiers = utils.cibuildwheel_get_build_identifiers(project_dir)
|
||||
assert len(expected_wheels) == len(build_identifiers), (
|
||||
f"{expected_wheels} vs {build_identifiers}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user