Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/autotest_server/testers/py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def settings():
prop = components["PyTestData"]["properties"]["output_verbosity"]
if "anyOf" in prop:
prop["enum"] = [v for sub in prop.pop("anyOf") for v in sub["enum"]]
# The runtime default "" is a fall-back sentinel that is not a valid choice in
# either tester branch of the dependencies block; dropping it lets the form
# apply the branch default instead.
prop.pop("default", None)

# Inject dependencies for output_verbosity for JSON Schema form
json_schema["properties"]["test_data"]["items"]["dependencies"] = {
Expand Down
14 changes: 14 additions & 0 deletions server/autotest_server/tests/testers/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ def test_valid_simple_schema(tester, files_list):
instance = json.load(f)

jsonschema.validate(instance, schema)


def test_py_output_verbosity_defaults_match_tester_branches():
"""A base default that no dependencies branch accepts leaves new test groups
invalid in the settings form (MarkUsProject/Markus#8129)."""
schemas, definitions = get_settings()
prop = definitions["PyTestData"]["properties"]["output_verbosity"]
branches = schemas["py"]["properties"]["test_data"]["items"]["dependencies"]["tester"]["oneOf"]
branch_enums = [branch["properties"]["output_verbosity"]["enum"] for branch in branches]
if "default" in prop:
assert any(prop["default"] in enum for enum in branch_enums)
for branch in branches:
verbosity = branch["properties"]["output_verbosity"]
assert verbosity["default"] in verbosity["enum"]
Loading