-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
60 lines (39 loc) · 1.51 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
from typing import Any
from invoke import task
@task
def test(context: Any) -> None:
context.run("pipenv run pytest tests/")
@task
def unittest(context: Any) -> None:
context.run("pipenv run pytest tests/test_unit")
@task
def frontend_tests(context: Any) -> None:
context.run("pipenv run pytest tests/test_frontend")
@task
def makemigrations(context: Any, app: str = "report_a_suspected_breach") -> None:
print("Running manage.py makemigrations")
context.run(f"pipenv run python django_app/manage.py makemigrations {app}")
@task
def migrate(context: Any, app: str = None) -> None:
print("Running manage.py migrate")
if app:
command = f"pipenv run python django_app/manage.py migrate {app}"
else:
command = "pipenv run python django_app/manage.py migrate"
context.run(command)
@task
def runserver(context: Any) -> None:
context.run("pipenv run python django_app/manage.py runserver", hide=False, pty=True)
@task
def createsuperuser(context: Any) -> None:
context.run("pipenv run python django_app/manage.py createsuperuser", hide=False, pty=True)
@task
def collectstatic(context: Any) -> None:
context.run("pipenv run python django_app/manage.py collectstatic --no-input", hide=False, pty=True)
@task
def black(context: Any, directory: str = ".") -> None:
print("Running black formatting")
context.run(f"pipenv run black {directory}")
@task
def mypy(context: Any, module: str = "django_app") -> None:
context.run(f"mypy {module}", hide=False, pty=True)