1
1
.PHONY : clean compile_translations coverage docs dummy_translations extract_translations \
2
- fake_translations help pull_translations push_translations quality requirements test test-all validate
2
+ fake_translations help pull_translations push_translations quality \
3
+ requirements swagger-ui test test-all upgrade validate
3
4
4
5
.DEFAULT_GOAL := help
5
6
6
7
define BROWSER_PYSCRIPT
7
8
import os, webbrowser, sys
9
+ from time import sleep
8
10
try:
9
11
from urllib import pathname2url
10
12
except:
11
13
from urllib.request import pathname2url
12
14
13
- webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
15
+ path_or_url = sys.argv[1]
16
+ delay = int(sys.argv[2]) if len(sys.argv) > 2 else 0
17
+ if delay > 0:
18
+ sleep(delay)
19
+ if '://' in path_or_url:
20
+ webbrowser.open(path_or_url)
21
+ else:
22
+ webbrowser.open("file://" + pathname2url(os.path.abspath(path_or_url)))
14
23
endef
15
24
export BROWSER_PYSCRIPT
16
25
BROWSER := python -c "$$BROWSER_PYSCRIPT"
@@ -32,7 +41,7 @@ compile_translations: ## compile translation files, outputting .po files for eac
32
41
./manage.py compilemessages
33
42
34
43
coverage : clean # # generate and view HTML coverage report
35
- py.test --cov-report html
44
+ pytest --cov-report html
36
45
$(BROWSER ) htmlcov/index.html
37
46
38
47
docs : # # generate Sphinx HTML documentation, including API docs
@@ -48,11 +57,11 @@ extract_translations: ## extract strings to be translated, outputting .mo files
48
57
49
58
fake_translations : extract_translations dummy_translations compile_translations # # generate and compile dummy translation files
50
59
51
- pip-compile : # # update the requirements/*.txt files with the latest packages satisfying requirements/*.in
60
+ upgrade : # # update the requirements/*.txt files with the latest packages satisfying requirements/*.in
52
61
pip install -q pip-tools
53
62
pip-compile --upgrade -o requirements/base.txt requirements/base.in
54
- pip-compile --upgrade -o requirements/dev.txt requirements/dev.in
55
- pip-compile --upgrade -o requirements/doc.txt requirements/doc.in
63
+ pip-compile --upgrade -o requirements/dev.txt requirements/dev.in requirements/quality.in
64
+ pip-compile --upgrade -o requirements/doc.txt requirements/base.in requirements/ doc.in
56
65
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
57
66
pip-compile --upgrade -o requirements/test.txt requirements/base.in requirements/test.in
58
67
pip-compile --upgrade -o requirements/travis.txt requirements/travis.in
@@ -73,8 +82,14 @@ requirements: ## install development environment requirements
73
82
pip install -qr requirements/dev.txt --exists-action w
74
83
pip-sync requirements/base.txt requirements/dev.txt requirements/private.* requirements/test.txt
75
84
85
+ swagger-ui : # # view Swagger UI for the REST API documentation
86
+ tox -e docs
87
+ $(BROWSER ) http://localhost:8000 5 &
88
+ echo " The REST API documentation should open in your browser within a few seconds"
89
+ . .tox/docs/bin/activate; ./manage.py migrate --settings=schema.settings; SWAGGER_JSON_PATH=docs/swagger.json ./manage.py runserver --settings=schema.settings
90
+
76
91
test : clean # # run tests in the current virtualenv
77
- py.test
92
+ pytest
78
93
79
94
test-all : # # run tests on every supported Python/Django combination
80
95
tox -e quality
0 commit comments