Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,19 @@ repos:
stages: ["pre-push"]
id: pytest
name: Run unit tests
entry: uv run pytest --quiet --cov-report=xml
entry: uv run coverage run -m pytest --quiet
- <<: *tests-config
id: test-coverage # https://youtu.be/70T6OxKwxm0
id: coverage-xml
name: Write coverage XML report
entry: uv run coverage xml --quiet
- <<: *tests-config
id: test-coverage
name: Tests have 100% run coverage
entry: >
uv run coverage report
--no-skip-covered
--include 'tests/*'
--fail-under 100
entry: uv run coverage report --no-skip-covered --include 'tests/*' --fail-under 100
- <<: *tests-config
id: coverage-badge
name: Generate coverage badge
entry: >
genbadge coverage
--input-file 'coverage.xml'
--output-file coverage.svg
--silent
entry: genbadge coverage --input-file 'coverage.xml' --output-file coverage.svg --silent
# https://github.com/smarie/python-genbadge/releases
additional_dependencies: ["genbadge[coverage]==1.1.3"]
language: python
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ dev = [
"pre-commit>=4.6.0",
]
test = [
"coverage>=7.13.5",
"covdefaults>=2.3.0",
"pytest>=9.0.3",
"pytest-cov>=7.0.0",
]


Expand All @@ -42,7 +42,11 @@ upgrade.shell = """
uv sync --refresh --upgrade
uv run pre-commit autoupdate
"""
test = "uv run pytest -vvv"
test.shell = """
uv run coverage run -m pytest -vvv
uv run coverage report --no-skip-covered
uv run coverage xml --quiet
"""

[tool.poe.tasks.lint]
control.expr = "sys.platform"
Expand All @@ -66,14 +70,11 @@ shell = """


[tool.pytest.ini_options]
addopts = "--cov"
testpaths = ["tests"]

[tool.coverage]
run.branch = true
run.plugins = ["covdefaults"] # https://youtu.be/70T6OxKwxm0
report.fail_under = 80
report.show_missing = true
report.exclude_lines = [
"@pytest.mark.skip",
"@pytest.mark.xfail",
Expand Down