feat: add option to opt-in free-threaded builds
This commit is contained in:
@@ -50,6 +50,7 @@ def test_build_filter_pre():
|
||||
assert build_selector("cp313-manylinux_x86_64")
|
||||
assert build_selector("cp37-win_amd64")
|
||||
assert build_selector("cp313-win_amd64")
|
||||
assert not build_selector("cp313t-manylinux_x86_64")
|
||||
|
||||
|
||||
def test_skip():
|
||||
@@ -144,6 +145,14 @@ def test_build_limited_python_patch():
|
||||
assert build_selector("cp37-manylinux_x86_64")
|
||||
|
||||
|
||||
def test_build_free_threaded_python():
|
||||
build_selector = BuildSelector(
|
||||
build_config="*", skip_config="", prerelease_pythons=True, free_threaded_support=True
|
||||
)
|
||||
|
||||
assert build_selector("cp313t-manylinux_x86_64")
|
||||
|
||||
|
||||
def test_testing_selector():
|
||||
# local import to avoid pytest trying to collect this as a test class!
|
||||
from cibuildwheel.util import TestSelector
|
||||
|
||||
@@ -415,3 +415,36 @@ def test_override_inherit_environment_with_references(tmp_path: Path):
|
||||
) == {
|
||||
"PATH": "/opt/local/bin:/opt/bin:/usr/bin:/bin",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("toml_assignment", "env", "expected_result"),
|
||||
[
|
||||
("", {}, False),
|
||||
("free-threaded-support = true", {}, True),
|
||||
("free-threaded-support = false", {}, False),
|
||||
("", {"CIBW_FREE_THREADED_SUPPORT": "0"}, False),
|
||||
("", {"CIBW_FREE_THREADED_SUPPORT": "1"}, True),
|
||||
("free-threaded-support = false", {"CIBW_FREE_THREADED_SUPPORT": "1"}, True),
|
||||
("free-threaded-support = true", {"CIBW_FREE_THREADED_SUPPORT": "0"}, False),
|
||||
("free-threaded-support = true", {"CIBW_FREE_THREADED_SUPPORT": ""}, True),
|
||||
("free-threaded-support = false", {"CIBW_FREE_THREADED_SUPPORT": ""}, False),
|
||||
],
|
||||
)
|
||||
def test_free_threaded_support(
|
||||
tmp_path: Path, toml_assignment: str, env: dict[str, str], expected_result: bool
|
||||
):
|
||||
args = CommandLineArguments.defaults()
|
||||
args.package_dir = tmp_path
|
||||
|
||||
pyproject_toml: Path = tmp_path / "pyproject.toml"
|
||||
pyproject_toml.write_text(
|
||||
textwrap.dedent(
|
||||
f"""\
|
||||
[tool.cibuildwheel]
|
||||
{toml_assignment}
|
||||
"""
|
||||
)
|
||||
)
|
||||
options = Options(platform="linux", command_line_arguments=args, env=env)
|
||||
assert options.globals.build_selector.free_threaded_support is expected_result
|
||||
|
||||
Reference in New Issue
Block a user