-
Notifications
You must be signed in to change notification settings - Fork 2
/
tasks.py
76 lines (53 loc) · 1.34 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
main_file = "main.py"
config_file = "config.py"
files = f"{main_file} {config_file}"
test_file = "test.py"
all_files = f"{files} {test_file}"
@task
def runserver(c):
""" Runs server app """
c.run(f"python3 dashboard/manage.py runserver")
@task
def migrate(c):
""" Migrate server app """
c.run(f"python3 dashboard/manage.py migrate")
@task
def run(c):
""" Runs main app """
c.run(f"python3 {main_file}")
@task
def full(c):
""" Runs full battery of tests """
test(c)
cov(c)
style(c)
@task
def test(c):
""" Runs all unit and integration tests """
c.run("green3 .")
@task
def cov(c):
""" Checks code coverage """
c.run(f"coverage run -m py.test {test_file}")
c.run(f"coverage report -m {files}")
c.run(f"coverage html {files}")
@task
def html(c):
""" Opens code coverage html """
c.run("python -m webbrowser -t \"htmlcov/index.html\"")
@task
def style(c):
""" Checks for PEP8 mistakes """
c.run(f"pycodestyle {all_files} tasks.py --ignore=E402,W504")
@task
def doc(c):
""" Checks for Documentation mistakes """
c.run(f"pydocstyle {all_files}")
@task
def install(c):
""" Install all required packages """
c.run("pip install -r requirements.txt")
@task(pre=[test, style])
def travis(c):
c.run(f"coverage run -m py.test {test_file}")