FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 9f3c984e authored by L. Bower's avatar L. Bower
Browse files

making full integration tests use the same test suite as half-fat ones (work ongoing)

parent 1b49992d
No related branches found
No related tags found
No related merge requests found
import abc
import glob
import os
import unittest
from integration.partial.integration_test_utils import IntegrationTestUtils
class BaseDepoTestSuite:
"""
to prevent the full integrations tests that extend the partial integrations tests running the tests twice,
the test suite is nested in a base class, to keep it at a seperate package-level
"""
class DepoTestSuite(unittest.TestCase):
TEST_OUT_PATH: str = None
TEST_START_DATE: str = '20221001'
TEST_JOB_DIR: str = "DEPOSITION_" + TEST_START_DATE
"""
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
def test_standard_run_input_status_success(self):
status_file_path = os.path.join(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
"STATUS_SUCCESS")
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(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
"plotting", "eastafrica", "images", "Weekly",
"deposition_eastafrica_leaf_rust_total_*_map.png")
ethiopia_image_path = os.path.join(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
"plotting", "ethiopia", "images", "Weekly",
"deposition_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(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
"plotting", "eastafrica", "input_csvs", "*.csv")
ethiopia_csv_path = os.path.join(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.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(self.EA_CSV_COUNT, ea_csv_count)
self.assertEqual(self.ETH_CSV_COUNT, eth_csv_count)
def test_standard_run_all_images_produced(self):
east_africa_image_path = os.path.join(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
"plotting", "eastafrica", "images", "Weekly", "*.png")
ethiopia_image_path = os.path.join(BaseDepoTestSuite.DepoTestSuite.TEST_OUT_PATH,
BaseDepoTestSuite.DepoTestSuite.TEST_JOB_DIR,
"plotting", "ethiopia", "images", "Weekly", "*.png")
ea_png_count: int = IntegrationTestUtils.count_files_in_wildcard(east_africa_image_path)
eth_png_count: int = IntegrationTestUtils.count_files_in_wildcard(ethiopia_image_path)
self.assertEqual(self.EA_PNG_COUNT, ea_png_count)
self.assertEqual(self.ETH_PNG_COUNT, eth_png_count)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment