From 078b62c1c5c2ef1c5f5ae0daba98e01c046aed16 Mon Sep 17 00:00:00 2001 From: David Kleiven Date: Thu, 22 Aug 2024 14:55:26 +0200 Subject: [PATCH] fix: update custom models --- tests/t_utils/custom_models.py | 23 ++++------------------- tests/test_full_model.py | 2 +- tests/test_graphdb.py | 2 +- tests/test_model_properties.py | 2 +- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/tests/t_utils/custom_models.py b/tests/t_utils/custom_models.py index 43fd1e91..55078a38 100644 --- a/tests/t_utils/custom_models.py +++ b/tests/t_utils/custom_models.py @@ -4,7 +4,7 @@ import tests.t_utils.common as t_common from cimsparql.graphdb import GraphDBClient, ServiceConfig -from cimsparql.model import ModelConfig, get_federated_cim_model, get_single_client_model +from cimsparql.model import ModelConfig, get_federated_cim_model logger = logging.getLogger() @@ -14,27 +14,12 @@ def combined_graphdb_service() -> ServiceConfig: return ServiceConfig(repo=repo, max_delay_seconds=1, token=os.getenv("GRAPHDB_TOKEN")) -@functools.lru_cache -def combined_model() -> t_common.ModelTest: - if os.getenv("CI") or os.getenv("GRAPHDB_TOKEN") is None: - return t_common.ModelTest(None, False, False) - service = combined_graphdb_service() - system_state_repo = f"repository:{service.repo},infer=false" - eq_repo = f"repository:{service.repo},infer=false" - model = None - try: - model = get_single_client_model(service, ModelConfig(system_state_repo, eq_repo)) - except Exception: - logger.exception("Failed to get single client model") - return t_common.ModelTest(model, False, False) - - @functools.lru_cache def federated_model() -> t_common.ModelTest: if os.getenv("CI") or os.getenv("GRAPHDB_TOKEN") is None: return t_common.ModelTest(None, False, False) - eq_repo = os.getenv("GRAPHDB_EQ", "abot_222-2-1_2") - system_state_repo = os.getenv("GRAPHDB_STATE", "abot_20220825T1621Z") + eq_repo = os.getenv("GRAPHDB_EQ", "abot-eq-1") + system_state_repo = os.getenv("GRAPHDB_STATE", "abot-situations-1") eq_client_cfg = ServiceConfig(eq_repo, max_delay_seconds=1) tpsvssh_client_cfg = ServiceConfig(system_state_repo, max_delay_seconds=1) eq_client = GraphDBClient(eq_client_cfg) @@ -52,4 +37,4 @@ def federated_model() -> t_common.ModelTest: def all_custom_models() -> list[t_common.ModelTest]: - return [combined_model(), federated_model()] + return [federated_model()] diff --git a/tests/test_full_model.py b/tests/test_full_model.py index 46ef3170..f5c3a7e6 100644 --- a/tests/test_full_model.py +++ b/tests/test_full_model.py @@ -4,7 +4,7 @@ def test_full_model_1(): - model = t_custom.combined_model().model + model = t_custom.federated_model().model if not model: pytest.skip("Require access to GRAPPHDB") full_model = model.full_model() diff --git a/tests/test_graphdb.py b/tests/test_graphdb.py index 7e411dd0..c91a6a07 100644 --- a/tests/test_graphdb.py +++ b/tests/test_graphdb.py @@ -92,7 +92,7 @@ async def test_not_empty(test_model: t_common.ModelTest): @pytest.fixture def model() -> Model: - test_model = t_custom.combined_model() + test_model = t_custom.federated_model() if not test_model.model: pytest.skip("Require access to GraphDB") return test_model.model diff --git a/tests/test_model_properties.py b/tests/test_model_properties.py index d4f61a8b..e0b534b9 100644 --- a/tests/test_model_properties.py +++ b/tests/test_model_properties.py @@ -81,7 +81,7 @@ async def get_node_consistency_test_data( async def collect_node_consistency_data() -> list[NodeConsistencyData]: - test_models = [t_custom.combined_model(), t_entsoe.micro_t1_nl()] + test_models = [t_custom.federated_model(), t_entsoe.micro_t1_nl()] if any(m.model is None and m.must_run_in_ci and os.getenv("CI") for m in test_models): pytest.fail("Model that must run in CI is None") res = await asyncio.gather(*[get_node_consistency_test_data(m.model) for m in test_models])