|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
import tomllib
|
|
|
|
|
from collections.abc import Mapping
|
|
|
|
|
from fnmatch import fnmatch
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
@@ -16,6 +17,8 @@ from cibuildwheel.util.packaging import DependencyConstraints
|
|
|
|
|
|
|
|
|
|
TYPE_CHECKING = False
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from collections.abc import Mapping
|
|
|
|
|
|
|
|
|
|
from .conftest import ArgsInterceptor
|
|
|
|
|
|
|
|
|
|
# CIBW_PLATFORM is tested in main_platform_test.py
|
|
|
|
@@ -37,7 +40,7 @@ def test_old_free_threaded(
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures("platform")
|
|
|
|
|
def test_output_dir(
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
) -> None:
|
|
|
|
|
OUTPUT_DIR = Path("some_output_dir")
|
|
|
|
|
|
|
|
|
@@ -49,7 +52,7 @@ def test_output_dir(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures("platform")
|
|
|
|
|
def test_output_dir_default(intercepted_build_args: "ArgsInterceptor") -> None:
|
|
|
|
|
def test_output_dir_default(intercepted_build_args: ArgsInterceptor) -> None:
|
|
|
|
|
main()
|
|
|
|
|
|
|
|
|
|
assert intercepted_build_args.args[0].globals.output_dir == Path("wheelhouse").resolve()
|
|
|
|
@@ -59,7 +62,7 @@ def test_output_dir_default(intercepted_build_args: "ArgsInterceptor") -> None:
|
|
|
|
|
@pytest.mark.parametrize("also_set_environment", [False, True])
|
|
|
|
|
def test_output_dir_argument(
|
|
|
|
|
also_set_environment: bool,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
OUTPUT_DIR = Path("some_output_dir")
|
|
|
|
@@ -75,7 +78,7 @@ def test_output_dir_argument(
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures("platform", "allow_empty")
|
|
|
|
|
def test_build_selector(
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
) -> None:
|
|
|
|
|
monkeypatch.setenv("CIBW_BUILD", "cp313-*")
|
|
|
|
|
monkeypatch.setenv("CIBW_SKIP", "cp39-*")
|
|
|
|
@@ -191,7 +194,7 @@ def test_manylinux_images(
|
|
|
|
|
image: str | None,
|
|
|
|
|
full_image: str,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if image is not None:
|
|
|
|
@@ -230,7 +233,7 @@ def test_repair_command(
|
|
|
|
|
repair_command: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if repair_command is not None:
|
|
|
|
@@ -259,7 +262,7 @@ def test_environment(
|
|
|
|
|
environment: Mapping[str, str],
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
env_string = " ".join(f"{k}={v}" for k, v in environment.items())
|
|
|
|
@@ -284,7 +287,7 @@ def test_test_requires(
|
|
|
|
|
test_requires: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if test_requires is not None:
|
|
|
|
@@ -307,7 +310,7 @@ def test_audit_requires(
|
|
|
|
|
audit_requires: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if audit_requires is not None:
|
|
|
|
@@ -331,7 +334,7 @@ def test_test_extras(
|
|
|
|
|
test_extras: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if test_extras is not None:
|
|
|
|
@@ -354,7 +357,7 @@ def test_test_command(
|
|
|
|
|
test_command: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if test_command is not None:
|
|
|
|
@@ -377,7 +380,7 @@ def test_before_build(
|
|
|
|
|
before_build: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if before_build is not None:
|
|
|
|
@@ -399,7 +402,7 @@ def test_build_verbosity(
|
|
|
|
|
build_verbosity: int | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if build_verbosity is not None:
|
|
|
|
@@ -420,7 +423,7 @@ def test_build_verbosity(
|
|
|
|
|
def test_config_settings(
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
config_settings = (
|
|
|
|
@@ -507,7 +510,7 @@ def test_before_all(
|
|
|
|
|
before_all: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
) -> None:
|
|
|
|
|
if before_all is not None:
|
|
|
|
@@ -533,7 +536,7 @@ def test_dependency_versions(
|
|
|
|
|
dependency_versions: str | None,
|
|
|
|
|
platform_specific: bool,
|
|
|
|
|
platform: str,
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor",
|
|
|
|
|
intercepted_build_args: ArgsInterceptor,
|
|
|
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
|
|
|
tmp_path: Path,
|
|
|
|
|
) -> None:
|
|
|
|
@@ -593,7 +596,7 @@ def test_debug_traceback(
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("method", ["unset", "command_line", "env_var"])
|
|
|
|
|
def test_enable(
|
|
|
|
|
method: str, intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
method: str, intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
) -> None:
|
|
|
|
|
monkeypatch.delenv("CIBW_ENABLE", raising=False)
|
|
|
|
|
|
|
|
|
@@ -613,7 +616,7 @@ def test_enable(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_enable_all(
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
) -> None:
|
|
|
|
|
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "all"])
|
|
|
|
|
monkeypatch.delenv("CIBW_ENABLE", raising=False)
|
|
|
|
@@ -625,7 +628,7 @@ def test_enable_all(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_enable_arg_inherits(
|
|
|
|
|
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
|
|
|
|
) -> None:
|
|
|
|
|
monkeypatch.setenv("CIBW_ENABLE", "pypy graalpy")
|
|
|
|
|
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "cpython-prerelease"])
|
|
|
|
@@ -652,7 +655,7 @@ def test_enable_arg_error_message(
|
|
|
|
|
assert "Valid group names are:" in err
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_defaults(platform: str, intercepted_build_args: "ArgsInterceptor") -> None:
|
|
|
|
|
def test_defaults(platform: str, intercepted_build_args: ArgsInterceptor) -> None:
|
|
|
|
|
main()
|
|
|
|
|
|
|
|
|
|
build_options: BuildOptions = intercepted_build_args.args[0].build_options(identifier=None)
|
|
|
|
|