diff --git a/.woodpecker/workflow.yaml b/.woodpecker/workflow.yaml index 0bdbe9e..b818927 100644 --- a/.woodpecker/workflow.yaml +++ b/.woodpecker/workflow.yaml @@ -23,7 +23,7 @@ steps: - python -m venv venv - . venv/bin/activate - python -m pip install --disable-pip-version-check --no-input --quiet -r requirements/test.txt - - python -m pytest + - python -m pytest --cov --cov-report term services: - name: database diff --git a/README.md b/README.md index 5af9907..8468af3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ ## Badges [![status-badge](https://ci.c-base.org/api/badges/9/status.svg)](https://ci.c-base.org/repos/9) +[![Tested with Hypothesis](./docs/hypothesis-tested-brightgreen.svg)](https://hypothesis.readthedocs.io/) +![Tests Status](./docs/tests-badge.svg) +![Coverage Status](./docs/coverage-badge.svg) ## Development diff --git a/docs/coverage-badge.svg b/docs/coverage-badge.svg new file mode 100644 index 0000000..8f71438 --- /dev/null +++ b/docs/coverage-badge.svg @@ -0,0 +1 @@ +coverage: 91.06%coverage91.06% \ No newline at end of file diff --git a/docs/hypothesis-tested-brightgreen.svg b/docs/hypothesis-tested-brightgreen.svg new file mode 100644 index 0000000..830e6bb --- /dev/null +++ b/docs/hypothesis-tested-brightgreen.svg @@ -0,0 +1 @@ +hypothesis: testedhypothesistested \ No newline at end of file diff --git a/docs/tests-badge.svg b/docs/tests-badge.svg new file mode 100644 index 0000000..45c9f3e --- /dev/null +++ b/docs/tests-badge.svg @@ -0,0 +1 @@ +tests: 9tests9 \ No newline at end of file diff --git a/justfile b/justfile index b6c14fb..58c3d1c 100644 --- a/justfile +++ b/justfile @@ -24,4 +24,11 @@ serve: test *ARGS: ENV_PATH=.env.test python -m pytest {{ARGS}} +cov *ARGS: + just test --cov --cov-report xml --cov-report term --junitxml=reports/junit/junit.xml {{ARGS}} + +badges: + genbadge coverage --output-file docs/coverage-badge.svg + genbadge tests --output-file docs/tests-badge.svg + alias fd := freshdeps diff --git a/pyproject.toml b/pyproject.toml index 9c87656..667696a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,25 @@ addopts = [ "--capture=sys", ] +[tool.coverage] +branch = true + +[tool.coverage.report] +skip_covered = true +skip_empty = true +show_missing = true + +[tool.coverage.run] +omit = [ + "*/migrations/*", + "VERSION.py", + "manage.py", + "config/[aw]sgi.py", +] + +[tool.coverage.xml] +output = "reports/coverage/coverage.xml" + [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" diff --git a/requirements/dev.in b/requirements/dev.in index 583c174..4a9c2d2 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -7,3 +7,4 @@ pip-compile-multi # superior dependency management rich # pretty exceptions on dev/console ruff # linter uv # resolver for pip-compile-multi +genbadge[tests,coverage] # create badges from coverage reports and pytest diff --git a/requirements/dev.txt b/requirements/dev.txt index bd3692d..6c6128c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -# SHA1:dabc24f4b9a41d5fae3314c9a05a98434dd126e3 +# SHA1:c1b1a9cb6cb941c70ba198b50670c6604e0daead # # This file is autogenerated by pip-compile-multi # To update, run: @@ -8,12 +8,17 @@ -r test.txt asttokens==3.0.0 build==1.2.2.post1 +certifi==2025.1.31 +charset-normalizer==3.4.1 click==8.1.8 decorator==5.2.1 +defusedxml==0.7.1 django-debug-toolbar==5.0.1 django-stubs==5.1.3 django-stubs-ext==5.1.3 executing==2.2.0 +genbadge==1.1.1 +idna==3.10 ipython==9.0.2 ipython-pygments-lexers==1.1.1 jedi==0.19.2 @@ -22,6 +27,7 @@ matplotlib-inline==0.1.7 mdurl==0.1.2 parso==0.8.4 pexpect==4.9.0 +pillow==11.1.0 pip==25.0.1 pip-compile-multi==2.8.0 pip-tools==7.4.1 @@ -30,6 +36,7 @@ ptyprocess==0.7.0 pure-eval==0.2.3 pygments==2.19.1 pyproject-hooks==1.2.0 +requests==2.32.3 rich==13.9.4 ruff==0.11.0 setuptools==76.0.0 @@ -37,6 +44,7 @@ stack-data==0.6.3 toposort==1.10 traitlets==5.14.3 types-pyyaml==6.0.12.20241230 +urllib3==2.3.0 uv==0.6.6 wcwidth==0.2.13 wheel==0.45.1 diff --git a/requirements/test.in b/requirements/test.in index 2c801fa..13b5dec 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -3,3 +3,4 @@ hypothesis[django] pytest pytest-django +pytest-cov diff --git a/requirements/test.txt b/requirements/test.txt index a038000..564af85 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,4 @@ -# SHA1:9bf147356ad56dbe073ef0973141bdfb94631c9b +# SHA1:5d0aacdba01d54c2715a30c8df5ee5aef977d83c # # This file is autogenerated by pip-compile-multi # To update, run: @@ -7,10 +7,12 @@ # -r prod.txt attrs==25.3.0 +coverage==7.7.0 hypothesis==6.129.3 iniconfig==2.0.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.5 +pytest-cov==6.0.0 pytest-django==4.10.0 sortedcontainers==2.4.0