1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
color := $(shell tput setaf 2)
off := $(shell tput sgr0)
PYTHON := $(if $(shell command -v python3),python3,python)
TARGETS = src tests
.PHONY: all
all: lint test
.PHONY: lint
lint: isort black mypy pylint
.PHONY: test
test: install unittest doctest pytest
.PHONY: install
install:
@printf '\n\n*****************\n'
@printf '$(color)Install flexmock$(off)\n'
@printf '*****************\n'
ifeq (${VIRTUAL_ENV},)
@printf 'Skipping install. VIRTUAL_ENV is not set.\n'
else
pip install .
endif
.PHONY: pytest
pytest:
@printf '\n\n*****************\n'
@printf '$(color)Running pytest$(off)\n'
@printf '*****************\n'
pytest
.PHONY: unittest
unittest:
@printf '\n\n*****************\n'
@printf '$(color)Running unittest$(off)\n'
@printf '*****************\n'
PYTHONPATH=$(shell pwd) $(PYTHON) tests/test_unittest.py
.PHONY: doctest
doctest:
@printf '\n\n*****************\n'
@printf '$(color)Running doctest$(off)\n'
@printf '*****************\n'
$(PYTHON) tests/test_doctest.py
.PHONY: mypy
mypy:
@printf '\n\n*****************\n'
@printf '$(color)Running mypy$(off)\n'
@printf '*****************\n'
mypy ${TARGETS}
.PHONY: isort
isort:
@printf '\n\n*****************\n'
@printf '$(color)Running isort$(off)\n'
@printf '*****************\n'
isort --check-only ${TARGETS}
.PHONY: black
black:
@printf '\n\n*****************\n'
@printf '$(color)Running black$(off)\n'
@printf '*****************\n'
black --check ${TARGETS}
.PHONY: pylint
pylint:
@printf '\n\n*****************\n'
@printf '$(color)Running pylint$(off)\n'
@printf '*****************\n'
pylint ${TARGETS}
.PHONY: docs
docs:
@printf '\n\n*****************\n'
@printf '$(color)Test building docs$(off)\n'
@printf '*****************\n'
mkdocs build --strict
|