Skip to content

Commit

Permalink
adds test coverage badge plugin and links to README
Browse files Browse the repository at this point in the history
  • Loading branch information
btylerburton committed Feb 6, 2025
1 parent 4730927 commit b3f5580
Show file tree
Hide file tree
Showing 12 changed files with 330 additions and 21 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./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
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

<!-- Pytest Coverage Comment:Begin -->
<!-- Pytest Coverage Comment:End -->

## Documentation

Current sequence diagrams are availale in the the `/docs/diagrams/dest` folder.
Expand Down
20 changes: 19 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
50 changes: 50 additions & 0 deletions tests/badges/functional/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions tests/badges/functional/tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions tests/badges/integration/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions tests/badges/integration/tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions tests/badges/unit/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

1 comment on commit b3f5580

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title Coverage Tests Skipped Failures Errors Time
Unit tests Coverage 39 0 💤 0 ❌ 0 🔥 0.93s ⏱️
Integration Tests Coverage 70 0 💤 0 ❌ 0 🔥 4.429s ⏱️
Functional Tests Coverage 2 0 💤 0 ❌ 0 🔥 8.449s ⏱️

Please sign in to comment.