From 52e0176d5d1f183bd4a5b23a5d936a5985198cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Sat, 22 Jul 2023 19:41:12 +0200 Subject: [PATCH] Add code test coverage reporting --- .github/workflows/python-package.yml | 11 ++++++++--- .gitignore | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b850f60..60fdef9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -28,7 +28,7 @@ jobs: run: | python -m pip install --upgrade setuptools python -m pip install --upgrade pip - python -m pip install flake8 pytest safety stix2 pytest-mock + python -m pip install flake8 pytest safety stix2 pytest-mock pytest-cov if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python -m pip install . - name: Lint with flake8 @@ -39,5 +39,10 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Safety checks run: safety check - - name: Test with pytest - run: pytest + - name: Test with pytest and coverage + run: pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=mvt tests/ | tee pytest-coverage.txt + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1249b00..766bd03 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,8 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ +pytest-coverage.txt +pytest.xml # Translations *.mo