From f910f1fa9cc11cc09558b3495389a89abc23f8af Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Mon, 26 Jul 2021 14:23:35 +0200 Subject: [PATCH] chore(tools): add user friendly coverage make command - add a command allowing to run tests and coverage in one go --- Makefile | 7 +++++++ script/actions_utils/coverage.sh | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 041b36c33..855351dc8 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,13 @@ mypy_test: mypy_ci: mypy mypy_test .PHONY: mypy_ci +pytest_and_coverage: pytest coverage +.PHONY: pytest_and_coverage + +coverage: + @if [[ "$$BB" == "" ]]; then BB=origin/main; fi && poetry run diff-cover coverage.xml --fail-under 100 --html-report coverage.html --compare-branch $$BB +.PHONY: coverage + docs: cd docs && poetry run make html .PHONY: docs diff --git a/script/actions_utils/coverage.sh b/script/actions_utils/coverage.sh index 6389a4e64..9fbd08376 100755 --- a/script/actions_utils/coverage.sh +++ b/script/actions_utils/coverage.sh @@ -6,9 +6,7 @@ set +e CURR_DIR=`dirname $0` # Run diff-coverage -poetry run diff-cover coverage.xml --fail-under 100 \ ---html-report coverage.html \ ---compare-branch origin/"$1" | tee diff-coverage.txt +BB="origin/$1" make coverage | tee diff-coverage.txt # Get exit code without closing the script TEST_EXIT_CODE="$?"