Skip to content

Commit 2d972c3

Browse files
committed
Update options schema
1 parent a36c38d commit 2d972c3

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

bin/generate_schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@
243243
non_global_options = {k: {"$ref": f"#/properties/{k}"} for k in schema["properties"]}
244244
del non_global_options["build"]
245245
del non_global_options["skip"]
246-
del non_global_options["container-engine"]
247246
del non_global_options["test-skip"]
248247

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

256255
del not_linux["environment-pass"]
256+
del not_linux["container-engine"]
257257
for key in list(not_linux):
258258
if "linux-" in key:
259259
del not_linux[key]

cibuildwheel/resources/cibuildwheel.schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@
491491
"config-settings": {
492492
"$ref": "#/properties/config-settings"
493493
},
494+
"container-engine": {
495+
"$ref": "#/properties/container-engine"
496+
},
494497
"dependency-versions": {
495498
"$ref": "#/properties/dependency-versions"
496499
},
@@ -579,6 +582,9 @@
579582
"config-settings": {
580583
"$ref": "#/properties/config-settings"
581584
},
585+
"container-engine": {
586+
"$ref": "#/properties/container-engine"
587+
},
582588
"environment": {
583589
"$ref": "#/properties/environment"
584590
},

unit_test/validate_schema_test.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,39 @@ def test_validate_default_schema():
2020
assert validator(example) is not None
2121

2222

23-
def test_validate_bad_container_engine():
23+
def test_validate_container_engine():
24+
"""
25+
This test checks container engine can be overridden - it used to be a
26+
global option but is now a build option.
27+
"""
28+
2429
example = tomllib.loads(
2530
"""
31+
[tool.cibuildwheel]
32+
container-engine = "docker"
33+
2634
[tool.cibuildwheel.linux]
2735
container-engine = "docker"
36+
37+
[[tool.cibuildwheel.overrides]]
38+
select = "*_x86_64"
39+
container-engine = "docker; create_args: --platform linux/arm64/v8"
40+
"""
41+
)
42+
43+
validator = validate_pyproject.api.Validator()
44+
assert validator(example) is not None
45+
46+
47+
@pytest.mark.parametrize("platform", ["macos", "windows"])
48+
def test_validate_bad_container_engine(platform: str):
49+
"""
50+
container-engine is not a valid option for macos or windows
51+
"""
52+
example = tomllib.loads(
53+
f"""
54+
[tool.cibuildwheel.{platform}]
55+
container-engine = "docker"
2856
"""
2957
)
3058

0 commit comments

Comments
 (0)