diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ef531ba09fb84a6a70c1fc8f3c6a79e43f8b6e6..c34d9a24bdfacd3795dd2f64bdbd8017ea8ba71e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,6 +47,7 @@ tests: when: always paths: - badges/ + - test/ coverage: tags: @@ -88,6 +89,9 @@ pages: - mkdir -p public/coverage - cp -af coverage/. public/coverage - ls public/coverage + - mkdir -p public/test + - cp -af test/. public/test + - ls public/test - ls public when: always artifacts: @@ -97,8 +101,10 @@ pages: - public - badges/ - coverage/ + - test/ cache: key: old-pages paths: - public/badges/ - public/coverage/ + - public/test/ diff --git a/CI/run_pytest.sh b/CI/run_pytest.sh index 4ba24b11a0aa4de7a9f5aca5fe93a4101986d98d..d8755448cfaaf9c1477add0929ecc65cc1115ba4 100644 --- a/CI/run_pytest.sh +++ b/CI/run_pytest.sh @@ -1,10 +1,21 @@ #!/bin/bash # run pytest for all modules -python3 -m pytest test/ | tee test_results.out +python3 -m pytest --html=report.html --self-contained-html test/ | tee test_results.out IS_FAILED=$? +# move html test report +mkdir test/ +BRANCH_NAME=$( echo -e "${CI_COMMIT_REF_NAME////_}") +mkdir test/${BRANCH_NAME} +mkdir test/recent +cp report.html test/${BRANCH_NAME}/. +cp report.html test/recent/. +if [[ "${CI_COMMIT_REF_NAME}" = "master" ]]; then + cp -r report.html test/. +fi + # exit 0 if no tests implemented RUN_NO_TESTS="$(grep -c 'no tests ran' test_results.out)" if [[ ${RUN_NO_TESTS} > 0 ]]; then diff --git a/requirements.txt b/requirements.txt index 4f4c9fd2d3311335f43fe9efa367205a2e0c196f..cdf035784475dac51d17173e7863dbf483e20101 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,5 @@ requests==2.22.0 pytest==5.2.1 pytest-lazy-fixture==0.6.1 pytest-cov +pytest-html pydot diff --git a/test/test_data_generator.py b/test/test_data_generator.py index 12162c7d6ebdb12262ab987b62eab6e4cf879ccd..3084647657a9bf7b88200f7691a45dbee5a8c3cf 100644 --- a/test/test_data_generator.py +++ b/test/test_data_generator.py @@ -43,9 +43,9 @@ class TestDataGenerator: assert len(gen) == 3 def test_iter(self, gen): - assert hasattr(gen, 'iterator') is False + assert hasattr(gen, '_iterator') is False iter(gen) - assert hasattr(gen, 'iterator') + assert hasattr(gen, '_iterator') assert gen._iterator == 0 def test_next(self, gen):