From 741453cf8b9195aa8a65be4c24400760d08df261 Mon Sep 17 00:00:00 2001 From: lb584 <lb584@cam.ac.uk> Date: Thu, 20 Oct 2022 16:49:12 +0100 Subject: [PATCH] adding test utils --- tests/integration/integration_test_utils.py | 2 ++ tests/integration/test_deposition.py | 6 ++---- tests/integration/test_env_suit.py | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/integration/integration_test_utils.py b/tests/integration/integration_test_utils.py index b4f228a..c7a5c0d 100644 --- a/tests/integration/integration_test_utils.py +++ b/tests/integration/integration_test_utils.py @@ -4,6 +4,8 @@ from datetime import datetime class IntegrationTestUtils: + TEMP_CONFIG_FILE_PATH: str = "../test_data/test_deployment/regions/EastAfrica/workspace/temp_config.json" + @staticmethod def load_json_file(file: str) -> dict: with open(file) as config_file: diff --git a/tests/integration/test_deposition.py b/tests/integration/test_deposition.py index cfa6069..f64dae7 100644 --- a/tests/integration/test_deposition.py +++ b/tests/integration/test_deposition.py @@ -7,8 +7,6 @@ from integration.integration_test_utils import IntegrationTestUtils class TestDeposition(unittest.TestCase): - TEMP_CONFIG_FILE_PATH: str = "../test_data/test_deployment/regions/EastAfrica/workspace/temp_config.json" - def setUp(self) -> None: super().setUp() default_config = '../test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json' @@ -23,7 +21,7 @@ class TestDeposition(unittest.TestCase): from Processor import run_Process, set_log_level args_dict: dict = {} args_dict['component'] = 'Deposition' - args_dict['config_paths'] = [TestDeposition.TEMP_CONFIG_FILE_PATH] + args_dict['config_paths'] = [IntegrationTestUtils.TEMP_CONFIG_FILE_PATH] args_dict['log_level'] = 'error' args_dict['live'] = False args_dict['start_date'] = '20221001' @@ -40,7 +38,7 @@ class TestDeposition(unittest.TestCase): run_dict['SubRegionNames'].remove('Kenya') run_dict['Deposition']['EWS-Plotting'].pop('Kenya', None) - IntegrationTestUtils.write_json_file(run_dict, self.TEMP_CONFIG_FILE_PATH) + IntegrationTestUtils.write_json_file(run_dict, IntegrationTestUtils.TEMP_CONFIG_FILE_PATH) run_Process(args_dict) self.assertTrue(True) diff --git a/tests/integration/test_env_suit.py b/tests/integration/test_env_suit.py index f2c45b1..3366cab 100644 --- a/tests/integration/test_env_suit.py +++ b/tests/integration/test_env_suit.py @@ -3,7 +3,6 @@ import os import unittest from integration.integration_test_utils import IntegrationTestUtils -from integration.test_deposition import TestDeposition class TestEnvSuit(unittest.TestCase): @@ -21,7 +20,7 @@ class TestEnvSuit(unittest.TestCase): from Processor import run_Process, set_log_level args_dict: dict = {} args_dict['component'] = 'Environment' - args_dict['config_paths'] = [TestDeposition.TEMP_CONFIG_FILE_PATH] + args_dict['config_paths'] = [IntegrationTestUtils.TEMP_CONFIG_FILE_PATH] args_dict['log_level'] = 'error' args_dict['live'] = False args_dict['start_date'] = '20221001' @@ -41,7 +40,7 @@ class TestEnvSuit(unittest.TestCase): run_dict['SubRegionNames'].remove('Kenya') - IntegrationTestUtils.write_json_file(run_dict, TestDeposition.TEMP_CONFIG_FILE_PATH) + IntegrationTestUtils.write_json_file(run_dict, IntegrationTestUtils.TEMP_CONFIG_FILE_PATH) run_Process(args_dict) self.assertTrue(True) -- GitLab