-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·56 lines (45 loc) · 1.7 KB
/
Makefile
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
# basic:
SHELL:=bash
PROJECT_NAME=NaiveNeurals
PWD:=$(shell pwd)
PYTHONPATH=$(PWD)
UNIT_TESTS_DIR=unit_tests/
FUNCTIONAL_TESTS_DIR=functional_tests/
VENV=venv/bin
PIP=$(VENV)/pip3
PIP_FLAGS=--trusted-host=http://pypi.python.org/simple/
PYTEST=$(VENV)/py.test
PYLINT=$(VENV)/pylint
COVERAGE=$(VENV)/coverage
MYPY=$(VENV)/mypy
MYPYFLAGS=--ignore-missing-imports --follow-imports=skip
HOST_PYTHON_VER:=$(shell which python3.6)
.PHONY: all venv clean test test_pytest test_gen_coverage_rep test_pylint test_mypy git-status commit-id
all: venv test clean
venv: venv/bin/activate
venv/bin/activate: requirements.txt
test -d venv || virtualenv -p $(HOST_PYTHON_VER) venv
$(PIP) $(PIP_FLAGS) install -Ur requirements.txt
touch venv/bin/activate
test_unit:
PYTHONPATH=$(PYTHONPATH) $(PYTEST) --verbose --color=yes --cov=$(PROJECT_NAME) --cov-config .coveragerc --tb=short $(UNIT_TESTS_DIR)
test_functional:
PYTHONPATH=$(PYTHONPATH) $(PYTEST) --verbose --color=yes --cov-config .coveragerc --tb=short $(FUNCTIONAL_TESTS_DIR) -s
test_pylint:
find $(PROJECT_NAME) -name '*.py' | xargs $(PYLINT) --rcfile=$(PWD)/.pylintrc
test_gen_coverage_rep:
$(COVERAGE) report --fail-under=90
test_mypy:
find $(PROJECT_NAME) -name '*.py' | xargs $(MYPY) $(MYPYFLAGS)
test: test_pylint test_mypy test_unit test_functional test_gen_coverage_rep
clean:
rm -rf htmlcov
rm -rf .coverage
rm -rf .cache
rm -rf .mypy_cache
rm -rf .pytest_cache
find -name '$(PROJECT_NAME).log' | xargs rm -rf
find $(PROJECT_NAME) -name '*.pyc' | xargs rm -rf
find $(PROJECT_NAME) -name '__pycache__' -type d | xargs rm -rf
find $(UNIT_TESTS_DIR) -name '__pycache__' -type d | xargs rm -rf
find $(FUNCTIONAL_TESTS_DIR) -name '__pycache__' -type d | xargs rm -rf