From 25bd5e9a3ceeee4992e77576eba634c8f9740aa0 Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Wed, 15 Mar 2023 17:11:36 +0000
Subject: [PATCH] more test work

---
 tests/integration/full/full_test_env_suit.py  | 56 ++-----------------
 tests/integration/partial/test_survey.py      |  2 +-
 .../test_suites/depo_test_suite.py            | 14 +----
 .../test_suites/env_suit_test_suite.py        | 18 +++---
 4 files changed, 16 insertions(+), 74 deletions(-)

diff --git a/tests/integration/full/full_test_env_suit.py b/tests/integration/full/full_test_env_suit.py
index 9d728d7..a88ea23 100644
--- a/tests/integration/full/full_test_env_suit.py
+++ b/tests/integration/full/full_test_env_suit.py
@@ -12,8 +12,10 @@ from integration.test_suites.env_suit_test_suite import BaseEnvSuitTestSuite
 class FullTestEnvSuit(BaseEnvSuitTestSuite.EnvSuitTestSuite):
 
     def set_expected_values(self):
-        pass
-
+        self.EA_CSV_COUNT: int = 18
+        self.ETH_CSV_COUNT: int = 18
+        self.EA_PNG_COUNT: int = 6
+        self.ETH_PNG_COUNT: int = 6
 
     def setUp(self) -> None:
 
@@ -51,56 +53,6 @@ class FullTestEnvSuit(BaseEnvSuitTestSuite.EnvSuitTestSuite):
                                                    IntegrationTestUtils.EMAIL_CRED_PATH)
 
 
-    # def test_standard_run_input_status_success(self):
-    #     status_file_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR, "STATUS_SUCCESS")
-    #     print(f"looking for {status_file_path}")
-    #     success_file_exists: bool = os.path.isfile(status_file_path)
-    #     self.assertTrue(success_file_exists)
-    #
-    #
-    # def test_standard_run_input_all_regions_ran(self):
-    #     """
-    #     working on the assumption that if there are images for each region, it must have run through
-    #     (at least past the region iteration)
-    #     """
-    #
-    #     east_africa_image_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR,
-    #                                           "plotting", "eastafrica", "images", "Weekly",
-    #                                           "suitability_eastafrica_leaf_rust_total_*_map.png")
-    #     ethiopia_image_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR,
-    #                                        "plotting", "ethiopia", "images", "Weekly",
-    #                                        "suitability_ethiopia_leaf_rust_total_*_map.png")
-    #
-    #     ea_file_exists: bool = len(glob.glob(east_africa_image_path)) > 0
-    #     eth_file_exists: bool = len(glob.glob(ethiopia_image_path)) > 0
-    #     self.assertTrue(ea_file_exists)
-    #     self.assertTrue(eth_file_exists)
-    #
-    #
-    # def test_standard_run_all_input_csvs_produced(self):
-    #     east_africa_csv_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR,
-    #                                         "plotting", "eastafrica", "input_csvs", "*.csv")
-    #     ethiopia_csv_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR,
-    #                                      "plotting", "ethiopia", "input_csvs", "*.csv")
-    #
-    #     ea_csv_count: int = IntegrationTestUtils.count_files_in_wildcard(east_africa_csv_path)
-    #     eth_csv_count: int = IntegrationTestUtils.count_files_in_wildcard(ethiopia_csv_path)
-    #     self.assertEqual(18, ea_csv_count)
-    #     self.assertEqual(18, eth_csv_count)
-    #
-    #
-    # def test_standard_run_all_images_produced(self):
-    #     east_africa_image_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR,
-    #                                           "plotting", "eastafrica", "images", "Weekly", "*.png")
-    #     ethiopia_image_path = os.path.join(FullTestEnvSuit.TEST_OUT_PATH, FullTestEnvSuit.TEST_JOB_DIR,
-    #                                        "plotting", "ethiopia", "images", "Weekly", "*.png")
-    #
-    #     ea_csv_count: int = IntegrationTestUtils.count_files_in_wildcard(east_africa_image_path)
-    #     eth_csv_count: int = IntegrationTestUtils.count_files_in_wildcard(ethiopia_image_path)
-    #     self.assertEqual(6, ea_csv_count)
-    #     self.assertEqual(6, eth_csv_count)
-
-
 if __name__ == '__main__':
     parser = argparse.ArgumentParser()
     parser.add_argument('--config', required = True)
diff --git a/tests/integration/partial/test_survey.py b/tests/integration/partial/test_survey.py
index 704a5d6..2653cb2 100644
--- a/tests/integration/partial/test_survey.py
+++ b/tests/integration/partial/test_survey.py
@@ -5,7 +5,7 @@ import unittest
 from integration.partial.integration_test_utils import IntegrationTestUtils
 
 
-class TestSurvey(unittest.TestCase):
+class TestSurvey(BaseEnvSuitTestSuite.EnvSuitTestSuite):
 
     TEST_OUT_PATH: str = "not_set"
     TEST_START_DATE: str = '20221001'
diff --git a/tests/integration/test_suites/depo_test_suite.py b/tests/integration/test_suites/depo_test_suite.py
index b81bbe1..2d0e9cd 100644
--- a/tests/integration/test_suites/depo_test_suite.py
+++ b/tests/integration/test_suites/depo_test_suite.py
@@ -21,24 +21,16 @@ class BaseDepoTestSuite:
         TEST_JOB_DIR: str = None
 
 
-        def __init__(self, methodName: str = ...) -> None:
-            super().__init__(methodName)
-
+        @abc.abstractmethod
+        def set_expected_values(self):
             """
-            these fields need to be overridden in the tests that use this test suite, override the 
-            'set_expected_values' function below
+            these fields need to be overridden in the tests that use this test suite
             """
             self.EA_CSV_COUNT: int = 0
             self.ETH_CSV_COUNT: int = 0
             self.EA_PNG_COUNT: int = 0
             self.ETH_PNG_COUNT: int = 0
 
-
-        @abc.abstractmethod
-        def set_expected_values(self):
-            return
-
-
         def test_standard_run_input_status_success(self):
             status_file_path = os.path.join(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
                                             BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
diff --git a/tests/integration/test_suites/env_suit_test_suite.py b/tests/integration/test_suites/env_suit_test_suite.py
index b6a20d8..800625d 100644
--- a/tests/integration/test_suites/env_suit_test_suite.py
+++ b/tests/integration/test_suites/env_suit_test_suite.py
@@ -20,19 +20,17 @@ class BaseEnvSuitTestSuite:
         TEST_START_DATE: str = None
         TEST_JOB_DIR: str = None
 
-        """
-        these fields need to be overridden in the tests that use this test suite, override the 
-        'set_expected_values' function below
-        """
-        EA_CSV_COUNT: int = None
-        ETH_CSV_COUNT: int = None
-        EA_PNG_COUNT: int = None
-        ETH_PNG_COUNT: int = None
-
 
         @abc.abstractmethod
         def set_expected_values(self):
-            return
+            """
+            these fields need to be overridden in the tests that use this test suite
+            """
+
+            self.EA_CSV_COUNT: int = 0
+            self.ETH_CSV_COUNT: int = 0
+            self.EA_PNG_COUNT: int = 0
+            self.ETH_PNG_COUNT: int = 0
 
 
         def test_standard_run_input_status_success(self):
-- 
GitLab