-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
40 lines (30 loc) · 832 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
"""
Tasks for use in `invoke` task runner:
https://www.pyinvoke.org/index.html
"""
from invoke import task
DOCKER_COMPOSE_FILE = "./docker-compose.yml"
@task
def pytest(c, target="."):
"""
Run pytest.
`poetry run invoke pytest`
"""
if not target:
target = ""
c.run(f"cd todo_everything && python -m pytest {target}")
@task
def test(c, target="."):
"""Alias for pytest?"""
return pytest(c, target)
@task
def dc_bash(c):
"""docker-compose run <something>."""
c.run(f"docker-compose --file {DOCKER_COMPOSE_FILE} run --rm web bash", pty=True)
@task
def dc_manage(c, command):
"""docker-compose run <something>."""
c.run(
f"docker-compose --file {DOCKER_COMPOSE_FILE} run --rm web python /home/webapp/todo_everything/manage.py {command}",
pty=True,
)