diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 32512306..b3cf3966 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -55,18 +55,6 @@ jobs: Integration Tests, pytest-coverage-integration.txt, pytest-integration.xml Functional Tests, pytest-coverage-functional.txt, pytest-functional.xml - - name: Update Readme with Coverage Html - if: ${{ github.ref == 'refs/heads/main' }} - run: | - sed -i '//,//c\\n\${{ steps.coverageComment.outputs.coverageHtml }}\n' ./README.md - - - name: Commit & Push changes to Readme - if: ${{ github.ref == 'refs/heads/main' }} - uses: actions-js/push@master - with: - message: Update coverage on Readme - github_token: ${{ secrets.GITHUB_TOKEN }} - deploy-development: if: github.ref == 'refs/heads/develop' name: deploy development diff --git a/Makefile b/Makefile index adee95e0..69b030df 100644 --- a/Makefile +++ b/Makefile @@ -28,13 +28,13 @@ install-static: ## Installs static assets npm run build test-unit: ## Runs unit tests. Compatible with dev environment / `make up` - poetry run pytest --cov-report term-missing --junitxml=pytest-unit.xml --cov=harvester ./tests/unit | tee pytest-coverage-unit.txt + poetry run pytest --local-badge-output-dir tests/badges/unit/ --cov-report term-missing --junitxml=pytest-unit.xml --cov=harvester ./tests/unit | tee pytest-coverage-unit.txt test-integration: ## Runs integration tests. Compatible with dev environment / `make up` - poetry run pytest --cov-report term-missing --junitxml=pytest-integration.xml --cov=harvester ./tests/integration | tee pytest-coverage-integration.txt + poetry run pytest --local-badge-output-dir tests/badges/integration/ --cov-report term-missing --junitxml=pytest-integration.xml --cov=harvester ./tests/integration | tee pytest-coverage-integration.txt test-functional: ## Runs integration tests. Compatible with dev environment / `make up` - poetry run pytest --noconftest --cov-report term-missing --junitxml=pytest-functional.xml --cov=harvester ./tests/functional | tee pytest-coverage-functional.txt + poetry run pytest --local-badge-output-dir tests/badges/functional/ --noconftest --cov-report term-missing --junitxml=pytest-functional.xml --cov=harvester ./tests/functional | tee pytest-coverage-functional.txt test: up test-unit test-integration ## Runs all tests. Compatible with dev environment / `make up` diff --git a/README.md b/README.md index d25497d3..a5441532 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # datagov-harvester +| Test Suite | Count | Coverage | +| --- | --- | --- | +| Unit | [![Unit Test Count](./tests/badges/unit/tests.svg)](./tests/unit)| [![Unit Test Coverage](./tests/badges/unit/coverage.svg)](./tests/unit)| +| Integration | [![Unit Test Count](./tests/badges/integration/tests.svg)](./tests/integration)| [![Unit Test Coverage](./tests/badges/integration/coverage.svg)](./tests/integration)| +| Functional | [![Functional Test Count](tests/badges/functional/tests.svg)](./tests/functional)| [![Unit Test Coverage](./tests/badges/functional/coverage.svg)](./tests/functional/)| + This repository holds the source code the Data.gov Harvester 2.0, which consists of two applications: - [datagov-harvest-admin](#datagov-harvest-admin) - [datagov-harvest-runner](#datagov-harvest-runner) -## Coverage - - - - ## Documentation Current sequence diagrams are availale in the the `/docs/diagrams/dest` folder. diff --git a/poetry.lock b/poetry.lock index 446b840d..c3af5d25 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1950,6 +1950,24 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +[[package]] +name = "pytest-local-badge" +version = "1.0.3" +description = "Generate local badges (shields) reporting your test suite status." +optional = false +python-versions = ">=3.7" +groups = ["dev"] +files = [ + {file = "pytest-local-badge-1.0.3.tar.gz", hash = "sha256:e13274cc9cadf91a1e3fa290d0bbbd371a365f9d719411e475596f722c2725a5"}, + {file = "pytest_local_badge-1.0.3-py3-none-any.whl", hash = "sha256:e14dc79922598e5b27ef4398a3537535ad115df2229ebba0259f6c6d92c6047b"}, +] + +[package.dependencies] +pytest = ">=6.1.0" + +[package.extras] +develop = ["black (>=22.12.0)", "build", "flake8-bugbear", "flake8-comprehensions", "flake8-import-order", "flake8-print", "pep8-naming", "pytest (>=7.1.0,<8)", "pytest-cov", "pytest-mock"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -2813,4 +2831,4 @@ testing = ["coverage[toml]", "zope.event", "zope.testing"] [metadata] lock-version = "2.1" python-versions = ">=3.13,<4.0" -content-hash = "b230ef21ab053ea69ac6f621f4ce610be0c9d48008943ef37d43f4ccf64b1377" +content-hash = "9ed43596d20312ea03954f47b2ecc150b03d29bdb0a5d5656eecda0e87aa915a" diff --git a/pyproject.toml b/pyproject.toml index 76fda655..35122241 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ isort = "^5.13.2" black = "^24.4.2" pre-commit = "^3.7.1" freezegun = "^1.5.1" +pytest-local-badge = "^1.0.3" [tool.ruff] # Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default. diff --git a/requirements-dev.txt b/requirements-dev.txt index 844603c8..04a1d11e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -18,6 +18,7 @@ platformdirs==4.3.6 ; python_version >= "3.13" and python_version < "4.0" pluggy==1.5.0 ; python_version >= "3.13" and python_version < "4.0" pre-commit==3.8.0 ; python_version >= "3.13" and python_version < "4.0" pytest-cov==4.1.0 ; python_version >= "3.13" and python_version < "4.0" +pytest-local-badge==1.0.3 ; python_version >= "3.13" and python_version < "4.0" pytest==8.3.4 ; python_version >= "3.13" and python_version < "4.0" python-dateutil==2.9.0.post0 ; python_version >= "3.13" and python_version < "4.0" pyyaml==6.0.2 ; python_version >= "3.13" and python_version < "4.0" diff --git a/tests/badges/functional/coverage.svg b/tests/badges/functional/coverage.svg new file mode 100644 index 00000000..ddf1128c --- /dev/null +++ b/tests/badges/functional/coverage.svg @@ -0,0 +1,50 @@ + + + + coverage: 8% + + + + + + + + + + + coverage + coverage + + + + 8% + 8% + + + + diff --git a/tests/badges/functional/tests.svg b/tests/badges/functional/tests.svg new file mode 100644 index 00000000..863694ce --- /dev/null +++ b/tests/badges/functional/tests.svg @@ -0,0 +1,50 @@ + + + + tests: 2 + + + + + + + + + + + tests + tests + + + + 2 + 2 + + + + diff --git a/tests/badges/integration/coverage.svg b/tests/badges/integration/coverage.svg new file mode 100644 index 00000000..f45ac63d --- /dev/null +++ b/tests/badges/integration/coverage.svg @@ -0,0 +1,50 @@ + + + + coverage: 91% + + + + + + + + + + + coverage + coverage + + + + 91% + 91% + + + + diff --git a/tests/badges/integration/tests.svg b/tests/badges/integration/tests.svg new file mode 100644 index 00000000..dba5dd78 --- /dev/null +++ b/tests/badges/integration/tests.svg @@ -0,0 +1,50 @@ + + + + tests: 70 + + + + + + + + + + + tests + tests + + + + 70 + 70 + + + + diff --git a/tests/badges/unit/coverage.svg b/tests/badges/unit/coverage.svg new file mode 100644 index 00000000..17909b48 --- /dev/null +++ b/tests/badges/unit/coverage.svg @@ -0,0 +1,50 @@ + + + + coverage: 39% + + + + + + + + + + + coverage + coverage + + + + 39% + 39% + + + + diff --git a/tests/badges/unit/tests.svg b/tests/badges/unit/tests.svg new file mode 100644 index 00000000..44c2e405 --- /dev/null +++ b/tests/badges/unit/tests.svg @@ -0,0 +1,50 @@ + + + + tests: 39 + + + + + + + + + + + tests + tests + + + + 39 + 39 + + + +