Skip to content

Commit

Permalink
Merge branch 'develop' into feature/ubuntu22
Browse files Browse the repository at this point in the history
  • Loading branch information
pet-mit authored Nov 21, 2024
2 parents 334e620 + cbd8213 commit ce40710
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 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 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 |
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 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 |
Expand Down
15 changes: 8 additions & 7 deletions tests/end_to_end/cucumber/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ***********************")
Expand Down
6 changes: 4 additions & 2 deletions tests/end_to_end/utils_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ 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():
for jsonpath in Path(path / folder).rglob(filename):
assert Path(path / folder).exists()
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 ce40710

Please sign in to comment.