Skip to content

Commit be35095

Browse files
committed
[#91202] parser: allow machines definition in test group
1 parent ccb9da6 commit be35095

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

protoplaster/conf/parser.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,21 @@ def __init__(self, origin: Path, name: str, content: dict[str, Any],
125125

126126
custom_path = to_path(custom_path)
127127

128-
for entry in content:
128+
is_group = isinstance(content, dict)
129+
tests = content.get("tests", []) if is_group else content
130+
group_machines = content.get("machines") if is_group else None
131+
132+
for entry in tests:
129133
for module_name, params in entry.items():
134+
params = (params or {}).copy()
135+
136+
if group_machines:
137+
if "machines" in params:
138+
msg = f'{self.origin.name}: "machines" defined in both group "{name}" and test "{module_name}"'
139+
pr_err(msg)
140+
raise ValueError(msg)
141+
params["machines"] = group_machines
142+
130143
if not ((module_name in test_modules_paths) or (
131144
(module_path := to_path(test_dir) / module_name).exists()
132145
and load_module(module_path, module_name)) or

0 commit comments

Comments
 (0)