Skip to content

Commit

Permalink
feat(api): reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
salemsd committed Jan 8, 2025
1 parent 3e1cb3d commit 82a8475
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/antares/craft/exceptions/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,9 @@ def __init__(self, study_id: str, message: str) -> None:
self.message = f"Could not get outputs for {study_id}: " + message
super().__init__(self.message)


class OutputDeletionError(Exception):
def __init__(self, study_id: str, output_name:str, message: str) -> None:
def __init__(self, study_id: str, output_name: str, message: str) -> None:
self.message = f"Could not delete the output {output_name} from study {study_id}: " + message
super().__init__(self.message)

Expand Down
1 change: 1 addition & 0 deletions src/antares/craft/model/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ def delete_output(self, output_name: str) -> None:
self._study_service.delete_output(output_name)
self._outputs.pop(output_name)


def _verify_study_already_exists(study_directory: Path) -> None:
if study_directory.exists():
raise FileExistsError(f"Study {study_directory.name} already exists.")
Expand Down
3 changes: 2 additions & 1 deletion src/antares/craft/service/api_services/study_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
from antares.craft.exceptions.exceptions import (
APIError,
BindingConstraintDeletionError,
OutputDeletionError,
OutputsRetrievalError,
StudyDeletionError,
StudySettingsUpdateError,
StudyVariantCreationError, OutputDeletionError,
StudyVariantCreationError,
)
from antares.craft.model.binding_constraint import BindingConstraint
from antares.craft.model.output import Output
Expand Down
10 changes: 7 additions & 3 deletions tests/integration/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,12 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop):
# ===== Output deletion =====

# run two new simulations for creating more outputs
study.wait_job_completion(study.run_antares_simulation(AntaresSimulationParameters(output_suffix="2")), time_out=60)
study.wait_job_completion(study.run_antares_simulation(AntaresSimulationParameters(output_suffix="3")), time_out=60)
study.wait_job_completion(
study.run_antares_simulation(AntaresSimulationParameters(output_suffix="2")), time_out=60
)
study.wait_job_completion(
study.run_antares_simulation(AntaresSimulationParameters(output_suffix="3")), time_out=60
)
study.read_outputs()

# delete_output
Expand All @@ -567,4 +571,4 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop):
# delete_outputs
study.delete_outputs()
assert len(study.get_outputs()) == 0
assert len(study.read_outputs()) == 0
assert len(study.read_outputs()) == 0

0 comments on commit 82a8475

Please sign in to comment.