-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
88 lines (65 loc) · 2.56 KB
/
makefile
File metadata and controls
88 lines (65 loc) · 2.56 KB
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
83
84
85
86
87
88
SHELL = /bin/bash
.PHONY: help test test_fails trouble clean help_venv check_env reqs
PROJECT=tbotg
.EXPORT_ALL_VARIABLES:
################################################################
# #
# PYTEST_IGNORE gets added to for stuff tester should ignore. #
# Note that we need := for assignment to keep appending #
PYTEST_IGONRE =
# Ignore setup.py
PYTEST_IGNORE := ${PYTEST_IGNORE} --ignore=setup.py
# Ignore venv
PYTEST_IGNORE := ${PYTEST_IGNORE} --ignore=venv_${PROJECT} --ignore=venv
# End PYTEST_IGNORE section #
# #
################################################################
PYTEST_TARGET = ${PROJECT} tests
PYTEST_FLAGS = -vvv --doctest-modules --doctest-glob='*.md'
PYTEST_EXTRA_FLAGS =
help:
@echo "This is a makefile for basic operations."
@echo ""
@echo "reqs: Update requirements (make sure to activate venv)"
@echo "test: Run regression tests via pytest."
@echo "test_fails: Run tests that failed previous run."
@echo "help_venv: Help on using virtual environments"
reqs:
if which pip | grep venv_ ; then echo "updating" ; else \
echo "suspicious pip does not look like venv; exit" && exit 1; fi
pip install -r requirements.txt
clean:
rm -rf .pytype
find . -name \*_flymake.py -print -exec rm {} \;
find . -name '*~' -print -exec rm {} \;
find ${PROJECT} -name '*.pyc' -print -exec rm {} \;
find . -name '*.pyi' -print -exec rm {} \;
find . -name archived_logs -print -exec rm -fr {} \;
find . -name latest_logs -print -exec rm -fr {} \;
@echo "done cleaning"
# Note that we set pipefail on the command since `tee` always returns status 0
# so we need pipefail if we want this command to fail on test failure.
test:
set -o pipefail && \
py.test ${PYTEST_FLAGS} ${PYTEST_IGNORE} \
${PYTEST_EXTRA_FLAGS} ${PYTEST_TARGET} 2>&1 | tee ./test_log.txt
lint:
flake8 ${PYTEST_TARGET} --exclude=${LINT_IGNORE}
pylint --rcfile=.pylintrc --disable C0209\
--jobs=4 --reports=n ${PYTEST_TARGET} \
--ignore=${LINT_IGNORE}
pytype:
pytype ${PYTEST_TARGET}
check:
${MAKE} lint
${MAKE} pytype
${MAKE} test
test_fails:
${MAKE} \
PYTEST_EXTRA_FLAGS="${PYTEST_EXTRA_FLAGS} --last-failed" test
help_venv:
@echo "Do 'python -m venv venv_${PROJECT}' to activate virtual env"
pypi: README.rst check
python3 setup.py sdist upload -r pypi
README.rst: README.org
pandoc --from=org --to=rst --output=README.rst README.org