From 172a301315f804cf172cf9ee55dd912ae2f45e71 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 29 Apr 2026 05:07:00 +0200 Subject: [PATCH] Fix tests once more Co-authored-by: Copilot --- .../component_tests/run_and_check_output.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/python/openproblems/src/openproblems/project/component_tests/run_and_check_output.py b/packages/python/openproblems/src/openproblems/project/component_tests/run_and_check_output.py index 3f05b78..be16770 100644 --- a/packages/python/openproblems/src/openproblems/project/component_tests/run_and_check_output.py +++ b/packages/python/openproblems/src/openproblems/project/component_tests/run_and_check_output.py @@ -21,9 +21,9 @@ def check_input_files(arguments: list) -> None: print(">> Checking that all required input files exist", flush=True) for arg in arguments: if arg["type"] == "file" and arg["direction"] == "input" and arg["required"]: - assert not arg["must_exist"] or path.exists( - arg["value"] - ), f"Input file '{arg['value']}' does not exist" + expected_path = arg.get("value") + assert expected_path is not None, f"Input argument '{arg['name']}' is missing a value" + assert not arg["must_exist"] or path.exists(expected_path), f"Input file '{expected_path}' does not exist" def check_output_files(arguments: list) -> None: @@ -33,9 +33,9 @@ def check_output_files(arguments: list) -> None: print(">> Checking that all required output files were created", flush=True) for arg in arguments: if arg["type"] == "file" and arg["direction"] == "output" and arg["required"]: - assert not arg["must_exist"] or path.exists( - arg["value"] - ), f"Output file '{arg['value']}' does not exist" + expected_path = arg.get("value") + assert expected_path is not None, f"Output argument '{arg['name']}' is missing a value" + assert not arg["must_exist"] or path.exists(expected_path), f"Output file '{expected_path}' does not exist" print(">> Validating the contents and format of output files", flush=True) for arg in arguments: @@ -216,15 +216,15 @@ def get_argument_sets(config: dict, resources_dir: str) -> dict: new_arg = arg.copy() arg_info = new_arg.get("info") or {} default_or_example = None - if arg_info.get("default"): + if arg_info.get("default") is not None: default_or_example = arg_info["default"] - elif arg_info.get("example"): + elif arg_info.get("example") is not None: default_or_example = arg_info["example"] if isinstance(default_or_example, list): default_or_example = default_or_example[0] # use example to find test resource file - if default_or_example and arg["type"] == "file": + if default_or_example is not None and arg["type"] == "file": if arg["direction"] == "input": value = f"{resources_dir}/{default_or_example}" else: