-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
43 lines (35 loc) · 941 Bytes
/
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
from subprocess import call
from sys import platform
from invoke import task
@task
def build(ctx):
if platform == "win32":
ctx.run("py src/initialize_database.py")
else:
ctx.run("python3 src/initialize_database.py", pty=True)
@task
def start(ctx):
if platform == "win32":
ctx.run("py src/index.py")
else:
ctx.run("python3 src/index.py", pty=True)
@task
def coverage(ctx):
if platform == "win32":
ctx.run("coverage run --branch -m pytest src")
else:
ctx.run("coverage run --branch -m pytest src", pty=True)
@task(pre=[coverage])
def coverage_report(ctx):
ctx.run("coverage html")
if platform != "win32" and platform != "darwin":
call(("xdg-open", "htmlcov/index.html"))
@task
def test(ctx):
ctx.run("pytest src")
@task
def lint(ctx):
ctx.run("pylint src")
@task
def autopep_format(ctx):
ctx.run("autopep8 --in-place --recursive src")