-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
76 lines (60 loc) · 1.13 KB
/
tasks.py
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
from invoke import task
@task(default=True)
def help(c):
"""
Print this help message and exit
"""
c.run("invoke --list")
@task
def populate_dev_db(c):
"""
Prepare and fill development DB with random data
"""
c.run("django-admin migrate")
c.run("django-admin app_populate_dev_db")
@task
def run(c):
"""
Start development server
"""
c.run("django-admin runserver 0.0.0.0:8000", pty=True)
@task
def sh(c):
"""
Open Django shell
"""
c.run("django-admin shell_plus", pty=True)
@task
def flake8(c):
"""
Check linting
"""
c.run("flake8 -j 1 --exclude=app/migrations", pty=True)
@task
def isort(c):
"""
Check imports
"""
c.run(
"find app/ -name '*.py' -not -path 'app/migrations*' | \
xargs isort --check-only --diff",
pty=True,
)
@task
def pytest(c):
"""
Run unit tests
"""
c.run(
"pytest --ds config.settings.base "
"--cov=app --cov-fail-under=100 --no-cov-on-fail",
pty=True,
)
@task
def test(c):
"""
Run all tests
"""
flake8(c)
isort(c)
pytest(c)