From c60b4948790528022a02a09f5c4dde6438071071 Mon Sep 17 00:00:00 2001
From: bronsen <kontakt+gitcommit@nrrd.de>
Date: Tue, 18 Mar 2025 00:18:31 +0100
Subject: [PATCH] [flair] generate badges from pytest and coverage reports

dev only, doesn't yet need to run on CI
---
 README.md               |  2 ++
 docs/coverage-badge.svg |  1 +
 docs/tests-badge.svg    |  1 +
 justfile                |  5 +++++
 requirements/dev.in     |  1 +
 requirements/dev.txt    | 10 +++++++++-
 6 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 docs/coverage-badge.svg
 create mode 100644 docs/tests-badge.svg

diff --git a/README.md b/README.md
index db652b4..8468af3 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@
 
 [![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 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 91.06%"><title>coverage: 91.06%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="114" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="53" height="20" fill="#4c1"/><rect width="114" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="865" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">91.06%</text><text x="865" y="140" transform="scale(.1)" fill="#fff" textLength="430">91.06%</text></g></svg>
\ 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 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="54" height="20" role="img" aria-label="tests: 9"><title>tests: 9</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="54" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="17" height="20" fill="#4c1"/><rect width="54" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="445" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="70">9</text><text x="445" y="140" transform="scale(.1)" fill="#fff" textLength="70">9</text></g></svg>
\ No newline at end of file
diff --git a/justfile b/justfile
index 2e7aae2..58c3d1c 100644
--- a/justfile
+++ b/justfile
@@ -26,4 +26,9 @@ test *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/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