Skip to content

Commit

Permalink
check return code
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Nov 6, 2024
1 parent d14d3f8 commit 08ab4a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tests/end_to_end/cucumber/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def run_antares_xpansion(context, method, memory=None, n: int = 1):
memory = True if memory is not None else False
# Clean study output
remove_outputs(context.tmp_study)
run_command(context.tmp_study, memory, method, n)
context.return_code = run_command(context.tmp_study, memory, method, n)

output_path = context.tmp_study / "output"
outputs = read_outputs(output_path, use_archive=not memory, lold=True, positive_unsupplied_energy=True)
Expand All @@ -101,6 +101,8 @@ def run_command(study_path, memory, method, n_mpi):
print(err)
print("*********************** End stderr ***********************")

return process.returncode


@then("the simulation takes less than {seconds:d} seconds")
def check_simu_time(context, seconds):
Expand Down
9 changes: 1 addition & 8 deletions tests/end_to_end/utils_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ def get_conf(key: str):


def get_mpi_command(allow_run_as_root=False, nproc: int = 1):
MPI_LAUNCHER = ""
MPI_N = ""
nproc_str = str(nproc)
if sys.platform.startswith("win32"):
MPI_LAUNCHER = "mpiexec"
MPI_N = "-n"
return [MPI_LAUNCHER, MPI_N, nproc_str]
return ["mpiexec", "-n", nproc_str]
elif sys.platform.startswith("linux"):
MPI_LAUNCHER = "mpirun"
MPI_N = "-np"
Expand All @@ -53,11 +49,8 @@ def remove_outputs(study_path):
def get_filepath(output_dir, folder, filename):
op = []
for path in Path(output_dir).iterdir():
print(f"----------{path}---------------")
for jsonpath in Path(path / folder).rglob(filename):
print(f"----------{jsonpath}---------------")
op.append(jsonpath)
print(f"op = {op}***************************")
assert len(op) == 1
return op[0]

Expand Down

0 comments on commit 08ab4a5

Please sign in to comment.