From 6834d6a46fcd328ed96e78af8f1d4521119f141b Mon Sep 17 00:00:00 2001 From: Gustav Wulf Date: Thu, 25 Jan 2024 11:55:11 +0100 Subject: [PATCH] Added 'make test-cover' to allow easy compare of coverage before push to PR. --- CONTRIBUTING.md | 6 ++++++ Makefile | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3bb0d3bbd..a38170f26 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,6 +60,12 @@ Clean everything: $ make clean ``` +Compare coverage to current `develop` branch to see if changes causes reduced coverage. +Please run before creating a PR. +```sh +$ make test-cover +``` + ## Automatic Keep all of the above tasks running on change: diff --git a/Makefile b/Makefile index 0deba4b5a..33d818a7e 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,13 @@ ifndef DISABLE_COVERAGE poetry run coveragespace update overall endif +.PHONY: test-cover +test-cover: install +# Run first to generate coverage data current code. + TEST_INTEGRATION=true poetry run pytest doorstop --doctest-modules --cov=doorstop --cov-report=xml --cov-report=term-missing +# Run second to generate coverage data for the code in the develop branch. + TEST_INTEGRATION=true diff-cover ./coverage.xml --compare-branch=$(shell git for-each-ref --sort=-committerdate refs/heads/develop | cut -f 1 -d ' ') + .PHONY: read-coverage read-coverage: bin/open htmlcov/index.html