Skip to content

Commit

Permalink
Update options schema
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Apr 26, 2024
1 parent a36c38d commit 2d972c3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@
non_global_options = {k: {"$ref": f"#/properties/{k}"} for k in schema["properties"]}
del non_global_options["build"]
del non_global_options["skip"]
del non_global_options["container-engine"]
del non_global_options["test-skip"]

overrides["items"]["properties"]["select"]["oneOf"] = string_array
Expand All @@ -254,6 +253,7 @@
not_linux = non_global_options.copy()

del not_linux["environment-pass"]
del not_linux["container-engine"]
for key in list(not_linux):
if "linux-" in key:
del not_linux[key]
Expand Down
6 changes: 6 additions & 0 deletions cibuildwheel/resources/cibuildwheel.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@
"config-settings": {
"$ref": "#/properties/config-settings"
},
"container-engine": {
"$ref": "#/properties/container-engine"
},
"dependency-versions": {
"$ref": "#/properties/dependency-versions"
},
Expand Down Expand Up @@ -579,6 +582,9 @@
"config-settings": {
"$ref": "#/properties/config-settings"
},
"container-engine": {
"$ref": "#/properties/container-engine"
},
"environment": {
"$ref": "#/properties/environment"
},
Expand Down
30 changes: 29 additions & 1 deletion unit_test/validate_schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,39 @@ def test_validate_default_schema():
assert validator(example) is not None


def test_validate_bad_container_engine():
def test_validate_container_engine():
"""
This test checks container engine can be overridden - it used to be a
global option but is now a build option.
"""

example = tomllib.loads(
"""
[tool.cibuildwheel]
container-engine = "docker"
[tool.cibuildwheel.linux]
container-engine = "docker"
[[tool.cibuildwheel.overrides]]
select = "*_x86_64"
container-engine = "docker; create_args: --platform linux/arm64/v8"
"""
)

validator = validate_pyproject.api.Validator()
assert validator(example) is not None


@pytest.mark.parametrize("platform", ["macos", "windows"])
def test_validate_bad_container_engine(platform: str):
"""
container-engine is not a valid option for macos or windows
"""
example = tomllib.loads(
f"""
[tool.cibuildwheel.{platform}]
container-engine = "docker"
"""
)

Expand Down

0 comments on commit 2d972c3

Please sign in to comment.