diff --git a/tests/end_to_end/cucumber/features/Benders_criterion_output_tests.feature b/tests/end_to_end/cucumber/features/Benders_criterion_output_tests.feature index 02320906e..3cb32f136 100644 --- a/tests/end_to_end/cucumber/features/Benders_criterion_output_tests.feature +++ b/tests/end_to_end/cucumber/features/Benders_criterion_output_tests.feature @@ -4,8 +4,8 @@ Feature: Benders Criterion files Scenario: xpansion-test-01 Given the study path is "data_test/examples/xpansion-test-01" When I run antares-xpansion with the benders method and 1 proc(s) - Then the simulation takes less than 300 seconds - And the simulation succeeds + Then the simulation succeeds + And the simulation takes less than 300 seconds And the expected positive unsupplied energy is | Outer loop | Ite | area1 | area2 | flex | peak | pv | semibase | store_in | store_out | | 0 | 1 | 5.3771400000e+05 | 4.3137090000e+06 | 0.0000000000e+00 | 0.0000000000e+00 | 0.0000000000e+00 | 0.0000000000e+00 | 2.6208000000e+07 | 0.0000000000e+00 | diff --git a/tests/end_to_end/cucumber/features/outer_loop_tests.feature b/tests/end_to_end/cucumber/features/outer_loop_tests.feature index daa53a3c5..3161061af 100644 --- a/tests/end_to_end/cucumber/features/outer_loop_tests.feature +++ b/tests/end_to_end/cucumber/features/outer_loop_tests.feature @@ -4,8 +4,8 @@ Feature: outer loop tests Scenario: a system with 4 nodes, on 1 timestep, 2 scenarios Given the study path is "data_test/external_loop_test" When I run outer loop with 1 proc(s) - Then the simulation takes less than 5 seconds - And the simulation succeeds + Then the simulation succeeds + And the simulation takes less than 5 seconds And the expected overall cost is 92.70005 And the solution is | variable | value | diff --git a/tests/end_to_end/cucumber/features/steps/steps.py b/tests/end_to_end/cucumber/features/steps/steps.py index 85b876945..76e6b9077 100644 --- a/tests/end_to_end/cucumber/features/steps/steps.py +++ b/tests/end_to_end/cucumber/features/steps/steps.py @@ -7,9 +7,9 @@ import subprocess import sys from pathlib import Path + import numpy as np from behave import * - from utils_functions import get_mpi_command, get_conf, read_outputs, remove_outputs @@ -83,19 +83,20 @@ def run_antares_xpansion(context, method, memory=None, n: int = 1): context.return_code = run_command(context.tmp_study, memory=memory, method=method, n_mpi=n, allow_run_as_root=get_conf("allow_run_as_root")) - output_path = context.tmp_study / "output" - outputs = read_outputs(output_path, use_archive=not memory, lold=True, positive_unsupplied_energy=True) - context.outputs = outputs.out_json - context.options_data = outputs.options_json - context.lold = outputs.lold - context.positive_unsupplied_energy = outputs.positive_unsupplied_energy + if context.return_code == 0: + output_path = context.tmp_study / "output" + outputs = read_outputs(output_path, use_archive=not memory, lold=True, positive_unsupplied_energy=True) + context.outputs = outputs.out_json + context.options_data = outputs.options_json + context.lold = outputs.lold + context.positive_unsupplied_energy = outputs.positive_unsupplied_energy def run_command(study_path, memory, method, n_mpi, allow_run_as_root=False): command = build_launch_command(study_path, method, nproc=n_mpi, in_memory=memory, allow_run_as_root=allow_run_as_root) print(f"Running command: {command}") - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = process.communicate() if process.returncode != 0: print("*********************** Begin stdout ***********************") diff --git a/tests/end_to_end/utils_functions.py b/tests/end_to_end/utils_functions.py index dc9a96704..91eabb8e8 100644 --- a/tests/end_to_end/utils_functions.py +++ b/tests/end_to_end/utils_functions.py @@ -48,6 +48,7 @@ def remove_outputs(study_path): def get_filepath(output_dir, folder, filename): op = [] print(f"output_dir: {output_dir}") + assert Path(output_dir).exists() print(f"folder: {folder}") print(f"filename: {filename}") for path in Path(output_dir).iterdir():