Skip to content

Commit eb5ecb0

Browse files
authored
build: 🔨 build coverage report and badge (#56)
1 parent 9cb48b0 commit eb5ecb0

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ htmlcov/
5252
.nox/
5353
.coverage
5454
.coverage.*
55+
coverage.*
5556
.cache
5657
nosetests.xml
57-
coverage.xml
5858
*.cover
5959
*.py,cover
6060
.hypothesis/

justfile

+20-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@ run-all: install-deps format-python check-python test-python check-commits build
66

77
# Install Python package dependencies
88
install-deps:
9-
uv sync
9+
uv sync --all-extras --dev
1010

1111
# Run the Python tests
1212
test-python:
13-
uv run pytest
13+
# - A short traceback (tb) mode to make it easier to view
14+
# - Use the `src/` package (importlib)
15+
# - Use code coverage on the `src/` package
16+
# - If tests fail, do not generate coverage report
17+
# - Create the coverage report in XML (for badge), terminal, and HTML
18+
# - Trigger failure if below 90% code coverage
19+
uv run pytest \
20+
--tb=short \
21+
--import-mode=importlib \
22+
--cov=src \
23+
--no-cov-on-fail \
24+
--cov-report=term \
25+
--cov-report=xml \
26+
--cov-report=html \
27+
--cov-fail-under=90
28+
# Make the badge from the coverage report
29+
uv run genbadge coverage \
30+
-i coverage.xml \
31+
-o htmlcov/coverage.svg
1432

1533
# Check Python code with the linter for any errors that need manual attention
1634
check-python:

0 commit comments

Comments
 (0)