1+ include .env # Read .env file
2+
13.PHONY : clean clean-test clean-pyc clean-build docs help
24.DEFAULT_GOAL := help
35
@@ -51,6 +53,7 @@ clean-test: ## remove test and coverage artifacts
5153 rm -f .coverage
5254 rm -fr htmlcov/
5355 rm -fr .pytest_cache
56+ find . -name ' *.gcov' -exec rm -fr {} +
5457
5558format-style-python : # # format Python files code style in-place
5659 @ pipenv run black ./
@@ -71,10 +74,28 @@ check-style-cpp: ## check for C++ code style in-place
7174 ( echo " \e[33mRun \e[34mmake format-style-cpp\e[33m to fix style errors.\e[0m" ; \
7275 exit 1 )
7376
74- run-tests-only : install # # run tests without style tests
75- pipenv run pytest tests
77+ check-coverage-python : # # check for Python code coverage
78+ @ echo " \e[36mChecking Python code coverage with MIN_COVERAGE=${MIN_COVERAGE} .\e[0m" && \
79+ pipenv run coverage report --fail-under ${MIN_COVERAGE} || \
80+ ( echo " \e[33mRun \e[34mmake show-coverage\e[33m to see a detailed HTML coverage report.\e[0m" ; \
81+ exit 1 )
82+
83+ check-coverage-cpp : # # check for C++ code coverage
84+ @ echo " \e[36mChecking C++ code style with MIN_COVERAGE=${MIN_COVERAGE} .\e[0m" && \
85+ pipenv run gcovr --print-summary --fail-under-line ${MIN_COVERAGE} || \
86+ ( echo " \e[33mRun \e[34mmake show-coverage\e[33m to see a detailed HTML coverage report.\e[0m" ; \
87+ exit 1 )
88+
89+ run-tests-only : install # # run tests with coverage generation and without style tests
90+ pipenv run coverage run -m pytest tests
91+
92+ test : check-style-python check-style-cpp run-tests-only check-coverage-python check-coverage-cpp # # check style and run tests
7693
77- test : check-style-python check-style-cpp run-tests-only # # check style and run tests
94+ show-coverage : # # report code coverage
95+ echo " \e[36mGenerating code coverage HTML report.\e[0m"
96+ pipenv run coverage html -d coverage_report/python
97+ pipenv run gcovr --html-details coverage_report/cpp/index.html
98+ $(BROWSER ) coverage_report/index.html
7899
79100release : dist # # package and upload a release
80101 twine upload dist/*
0 commit comments