Skip to content
Snippets Groups Projects
Commit a65345a4 authored by Saurabh Kumar's avatar Saurabh Kumar
Browse files

make the makefile more readable

Break test target into smaller targets
parent 189292c5
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,9 @@ help: ...@@ -3,7 +3,9 @@ help:
@echo "Usage:" @echo "Usage:"
@echo " make help prints this help." @echo " make help prints this help."
@echo " make lint run all python linting." @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 run the isort import linter."
@echo " make sort-fix fix import sort order." @echo " make sort-fix fix import sort order."
@echo " make style run the python code style linter." @echo " make style run the python code style linter."
...@@ -23,7 +25,20 @@ sort-fix: ...@@ -23,7 +25,20 @@ sort-fix:
style: style:
@echo "Checking code style with flake8" && flake8 . @echo "Checking code style with flake8" && flake8 .
test: lint .PHONY: cov-htmlcov
pytest --reuse-db --cov --cov-report term:skip-covered cov-html:
ifneq ("$(wildcard .coverage)","")
@rm -rf htmlcov @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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment