Skip to content

Commit

Permalink
Reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 committed Nov 15, 2024
1 parent 553196c commit b3a8c73
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 succeeds
And the simulation takes less than 300 seconds
Then the simulation takes less than 300 seconds
And the simulation succeeds
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 |
Expand Down
4 changes: 2 additions & 2 deletions tests/end_to_end/cucumber/features/outer_loop_tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 succeeds
And the simulation takes less than 5 seconds
Then the simulation takes less than 5 seconds
And the simulation succeeds
And the expected overall cost is 92.70005
And the solution is
| variable | value |
Expand Down
15 changes: 7 additions & 8 deletions tests/end_to_end/cucumber/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,19 @@ 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"))

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
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.PIPE)
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
out, err = process.communicate()
if process.returncode != 0:
print("*********************** Begin stdout ***********************")
Expand Down
6 changes: 2 additions & 4 deletions tests/end_to_end/utils_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ def remove_outputs(study_path):

def get_filepath(output_dir, folder, filename):
op = []
assert Path(output_dir).exists()
for path in Path(output_dir).iterdir():
assert Path(path / folder).exists()
for jsonpath in Path(path / folder).rglob( filename):
for jsonpath in Path(path / folder).rglob(filename):
op.append(jsonpath)
assert len(op) == 1
assert len(op) == 1
return op[0]


Expand Down

0 comments on commit b3a8c73

Please sign in to comment.