feat: add inherit to override (#1730)

* feat: add inherit to override

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: use dict and support prepend

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Refactor: simplifying by splitting the responsibilities of _dig_first

* Refactor to allow merging of string settings, and preserve table cascades

* docs: add some docs for inherit

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Apply suggestions from code review

Co-authored-by: Joe Rickerby <joerick@mac.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Henry Schreiner
2024-03-02 16:58:18 -05:00
committed by GitHub
co-authored by Joe Rickerby
parent ae2451a199
commit 8f58f71c2e
7 changed files with 567 additions and 145 deletions
+44
View File
@@ -72,6 +72,50 @@ def test_overrides_only_select():
validator(example)
def test_overrides_valid_inherit():
example = tomllib.loads(
"""
[[tool.cibuildwheel.overrides]]
inherit.repair-wheel-command = "append"
select = "somestring"
repair-wheel-command = ["something"]
"""
)
validator = validate_pyproject.api.Validator()
assert validator(example) is not None
def test_overrides_invalid_inherit():
example = tomllib.loads(
"""
[[tool.cibuildwheel.overrides]]
inherit.something = "append"
select = "somestring"
repair-wheel-command = "something"
"""
)
validator = validate_pyproject.api.Validator()
with pytest.raises(validate_pyproject.error_reporting.ValidationError):
validator(example)
def test_overrides_invalid_inherit_value():
example = tomllib.loads(
"""
[[tool.cibuildwheel.overrides]]
inherit.repair-wheel-command = "nothing"
select = "somestring"
repair-wheel-command = "something"
"""
)
validator = validate_pyproject.api.Validator()
with pytest.raises(validate_pyproject.error_reporting.ValidationError):
validator(example)
def test_docs_examples():
"""
Parse out all the configuration examples, build valid TOML out of them, and