Skip to content

Commit

Permalink
fix(api): fix failed tests (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
TLAIDI authored and laurent-laporte-pro committed Sep 12, 2023
1 parent bf9a80b commit ab44af5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/storage/integration/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def test_export_flat(
export_study_flat(
path_studies / "STA-mini",
export_path / "STA-mini-export",
Mock(),
outputs,
output_list,
)
Expand Down
10 changes: 9 additions & 1 deletion tests/variantstudy/model/test_variant_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from antarest.core.utils.fastapi_sqlalchemy import DBSessionMiddleware, db
from antarest.study.model import DEFAULT_WORKSPACE_NAME, RawStudy, StudyAdditionalData
from antarest.study.storage.variantstudy.command_factory import CommandFactory
from antarest.study.storage.variantstudy.model.dbmodel import VariantStudy
from antarest.study.storage.variantstudy.model.model import CommandDTO, GenerationResultInfoDTO
from antarest.study.storage.variantstudy.repository import VariantStudyRepository
from antarest.study.storage.variantstudy.variant_study_service import SNAPSHOT_RELATIVE_PATH, VariantStudyService
Expand All @@ -28,7 +29,12 @@
)


def test_commands_service(tmp_path: Path, command_factory: CommandFactory):
@patch(
"antarest.study.storage.variantstudy.variant_study_service.export_study_flat"
)
def test_commands_service(
mock_export, tmp_path: Path, command_factory: CommandFactory
):
engine = create_engine(
"sqlite:///:memory:",
echo=False,
Expand All @@ -41,6 +47,7 @@ def test_commands_service(tmp_path: Path, command_factory: CommandFactory):
custom_engine=engine,
session_args={"autocommit": False, "autoflush": False},
)

repository = VariantStudyRepository(LocalCache())
service = VariantStudyService(
raw_study_service=Mock(),
Expand Down Expand Up @@ -176,6 +183,7 @@ def test_smart_generation(mock_export, tmp_path: Path, command_factory: CommandF
def export_flat(
path_study: Path,
dest: Path,
study_factory: VariantStudy,
outputs: bool = True,
denormalize: bool = True,
) -> None:
Expand Down

0 comments on commit ab44af5

Please sign in to comment.