diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 63adfad9a30e337b22c30863e44c023678a61503..d3fb17eee1f42eb621614b8567dc12635dbb73a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,10 +99,9 @@ half_fat_tests: script: - cd $CI_PROJECT_DIR/tests/unit/coordinator/ - - python3 -m coverage run -m unittest * + - python3 -m coverage run -m run_rest_suite.py $CI_PROJECT_DIR/test_reports - python -m coverage report - python -m coverage html -d $CI_PROJECT_DIR/coverage - - pytest --junitxml=report.xml # - cd $CI_PROJECT_DIR/tests/integration/partial/ # - python3 -m coverage run -m unittest test_advisory.py # - python3 -m coverage run -m unittest test_deposition.py @@ -115,6 +114,7 @@ half_fat_tests: when: always paths: - $CI_PROJECT_DIR/coverage + - $CI_PROJECT_DIR/test_reports reports: junit: report.xml expire_in: 10 days @@ -134,6 +134,7 @@ half_fat_epi_tests: artifacts: paths: - $CI_PROJECT_DIR/coverage + - $CI_PROJECT_DIR/test_reports expire_in: 10 days full_fat_depo: diff --git a/conda-env-py3EWS-nobuilds.yml b/conda-env-py3EWS-nobuilds.yml index 6dd54b60a07ec2bb52838765406c9f2ba164a9a1..f3272859266d7b44951af9a016fa43cc5e9a8c7d 100644 --- a/conda-env-py3EWS-nobuilds.yml +++ b/conda-env-py3EWS-nobuilds.yml @@ -182,4 +182,7 @@ dependencies: - yaml=0.2.5 - zlib=1.2.11 - zstd=1.5.0 + - pip: + - coverage==6.5.0 + - html-testrunner==1.2.1 prefix: /storage/app/EWS/envs/conda/py3EWS diff --git a/conda-env-py3EWS-withbuilds.yml b/conda-env-py3EWS-withbuilds.yml index 91e247f14dab77470c02844f0fb6891b58748a7e..2eb778bd66bcd37682183fe4a1ef2a7f54678ea9 100644 --- a/conda-env-py3EWS-withbuilds.yml +++ b/conda-env-py3EWS-withbuilds.yml @@ -182,4 +182,7 @@ dependencies: - yaml=0.2.5=h7b6447c_0 - zlib=1.2.11=h7f8727e_4 - zstd=1.5.0=ha95c52a_0 + - pip: + - coverage==6.5.0 + - html-testrunner==1.2.1 prefix: /storage/app/EWS/envs/conda/py3EWS diff --git a/configs/docker/build/Dockerfile b/configs/docker/build/Dockerfile index 72dd0098340b2c1347163093263bd40adf83cdd5..5affde3674924ac0c8b76c43e50387764a927207 100644 --- a/configs/docker/build/Dockerfile +++ b/configs/docker/build/Dockerfile @@ -40,20 +40,6 @@ RUN groupadd -g $GID $GNAME RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME USER ewsmanager -#get the pythonpath ready to point at the pipeline code, which will get mounted at runtime -ENV CODE_DIR="/storage/app/EWS_prod/code/" -ENV flagdir=$CODE_DIR/flagdir -ENV epimodel=$CODE_DIR/epimodel -ENV advisory=$CODE_DIR/advisory_builder -ENV met_processing=$CODE_DIR/met_extractor_v2/met_data_extraction -ENV met_processor=$CODE_DIR/environmental_suitability/environmental_suitability -ENV plotting=$CODE_DIR/plotting/plotting -ENV post_processing=$CODE_DIR/post_processing/ews_postprocessing -ENV source_gen=$CODE_DIR/source_gen -ENV coordinator=$CODE_DIR/coordinator/coordinator -ENV coordinator_tests=$CODE_DIR/coordinator/tests -ENV PYTHONPATH=$PYTHONPATH:$flagdir:$epimodel:$advisory:$met_processing:$met_processor:$plotting:$source_gen:$post_processing:$coordinator:$coordinator_tests - RUN echo $PYTHONPATH WORKDIR /home/ewsmanager diff --git a/tests/integration/partial/integration_test_utils.py b/tests/integration/partial/integration_test_utils.py index 4e383b2d2e5cf7e27e1f88e6c1159d1753e303d4..943f0d1dab58e4e0b408bbf41ce5ef1789944ece 100644 --- a/tests/integration/partial/integration_test_utils.py +++ b/tests/integration/partial/integration_test_utils.py @@ -2,6 +2,7 @@ import glob import json import os from datetime import datetime +from importlib import reload from typing import List from zipfile import ZipFile @@ -81,6 +82,8 @@ class IntegrationTestUtils: # need EMAIL_CRED in the environment before we import Processor os.environ["EMAIL_CRED"] = IntegrationTestUtils.EMAIL_CRED_PATH + import Processor + reload(Processor) from Processor import run_Process, set_log_level args_dict: dict = {} diff --git a/tests/integration/partial/run_test_suite.py b/tests/integration/partial/run_test_suite.py new file mode 100644 index 0000000000000000000000000000000000000000..44033016aa0c550a3540025f422656dc7c9ae685 --- /dev/null +++ b/tests/integration/partial/run_test_suite.py @@ -0,0 +1,20 @@ +import sys +from unittest import TestLoader, TestSuite + +from HtmlTestRunner import HTMLTestRunner + + +from integration.partial.test_deposition import TestDeposition +from integration.partial.test_env_suit import TestEnvSuit + + +def run_tests_and_report(output: str): + tests: TestSuite = TestLoader().loadTestsFromTestCase(TestDeposition) + tests.addTests(TestLoader().loadTestsFromTestCase(TestEnvSuit)) + runner = HTMLTestRunner(output=output, combine_reports = True) + + runner.run(tests) + + +if __name__ == '__main__': + run_tests_and_report(sys.argv[1])