From 45bea8c788277587dac9853ccc9c958b704be43d Mon Sep 17 00:00:00 2001 From: Bill Wallis Date: Tue, 2 Jun 2026 22:09:20 +0100 Subject: [PATCH] test: ensure 100% test run coverage --- .pre-commit-config.yaml | 12 ++++++++++++ coverage.svg | 2 +- pyproject.toml | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba6a2c5..c3a170c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -94,6 +94,18 @@ repos: language: unsupported pass_filenames: false always_run: true + # https://youtu.be/70T6OxKwxm0 + - id: test-coverage + name: Tests have 100% run coverage + entry: > + coverage report + --no-skip-covered + --include 'tests/*' + --fail-under 100 + stages: ["pre-push"] + language: unsupported + pass_filenames: false + always_run: true - id: coverage-badge name: Generate coverage badge entry: > diff --git a/coverage.svg b/coverage.svg index ef52bd2..7175bd1 100644 --- a/coverage.svg +++ b/coverage.svg @@ -1 +1 @@ -coverage: 100.00%coverage100.00% \ No newline at end of file +coverage: 100.00%coverage100.00% \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6905e33..2bc2520 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ dev = [ "pre-commit>=4.5.1", ] test = [ + "covdefaults>=2.3.0", "pytest>=9.0.3", "pytest-cov>=7.0.0", ] @@ -73,11 +74,12 @@ shell = """ [tool.pytest.ini_options] -addopts = "--cov=src" +addopts = "--cov" testpaths = ["tests"] [tool.coverage] run.branch = true +run.plugins = ["covdefaults"] # https://youtu.be/70T6OxKwxm0 report.fail_under = 80 report.show_missing = true