From eca286e999381b5b5b382b9d3a6192f38b2c5008 Mon Sep 17 00:00:00 2001 From: Alexander Druz Date: Wed, 7 Feb 2024 11:28:48 +0100 Subject: [PATCH] Debug parsing --- main.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 6264255..c6df938 100755 --- a/main.py +++ b/main.py @@ -73,14 +73,28 @@ def parse_include_exclude(input_include_exclude: str) -> list: def assert_valid_extra(extra: Any) -> None: + """ + Validate strategy include/exclude. + """ if not isinstance(extra, list): raise TypeError( f"Include/exclude must be an array (Python list), but Python " f"{type(extra)} received." ) + # for combination in extra: + # if not isinstance(combination, dict): + # raise TypeError( + # f"Each include/exclude combination must a dict, but " + # f"{type(combination)} received." + # ) def assert_valid_matrix(matrix: Any) -> None: + """ + Validate strategy matrix. + """ + if matrix is None: + raise RuntimeError("Strategy matrix must define at least one combination.") if not isinstance(matrix, dict): raise TypeError( f"Matrix must be a mapping (Python dict), but Python " @@ -100,8 +114,7 @@ def parse_matrix(input_matrix: str) -> dict: matrix = yaml.load(input_matrix, Loader=yaml.loader.BaseLoader) print(matrix) - if matrix is None: - raise RuntimeError("Strategy matrix must define at least one combination.") + assert_valid_matrix(matrix) return matrix @@ -112,7 +125,7 @@ def parse_matrix(input_matrix: str) -> dict: print(yaml.dump({"matrix": matrix})) # output_matrix = json.dumps(matrix) - output_matrix = "{'include':[],'exclude':[]}" + output_matrix = "{'include':[['a','b']]}" output("matrix", output_matrix) setenv("MATRIX", output_matrix)