diff --git a/Makefile b/Makefile index da77c0ee234a161b4fcb95fbee6baa131a856b2f..39de3e839512c8e2884f4c03cfe2c4624220572d 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,9 @@ help: @echo "Usage:" @echo " make help prints this help." @echo " make lint run all python linting." - @echo " make test run all python linting and test" + @echo " make test run linting and test and generate html coverage report" + @echo " make py-test run all python tests and display coverage" + @echo " make cov-html generate html coverage report" @echo " make sort run the isort import linter." @echo " make sort-fix fix import sort order." @echo " make style run the python code style linter." @@ -23,7 +25,20 @@ sort-fix: style: @echo "Checking code style with flake8" && flake8 . -test: lint - pytest --reuse-db --cov --cov-report term:skip-covered +.PHONY: cov-htmlcov +cov-html: +ifneq ("$(wildcard .coverage)","") @rm -rf htmlcov - coverage html + @echo "Generate html coverage report..." && coverage html + @echo "Open 'htmlcov/index.html' in your browser to see the report." +else + $(error Unable to generate html coverage report, please run 'make test' or 'make py-test') +endif + +.PHONY: py-test +py-test: + @echo "Running python tests" + pytest --reuse-db --cov --cov-report term:skip-covered + +.PHONY: test +test: lint py-test cov-html