-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
32 lines (24 loc) · 933 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
import os
import shutil
from pathlib import Path
from invoke import task
SRC_DIR = Path("mcanitexgen")
@task
def install(c):
os.system("poetry lock -n")
os.system("poetry install -n")
os.system("poetry run pre-commit install --hook-type pre-commit")
os.system("poetry run pre-commit install --hook-type pre-push")
@task
def format(c):
os.system("poetry run black . --config pyproject.toml")
os.system(
f"poetry run isort {str(SRC_DIR)} --settings-path pyproject.toml --profile black"
)
os.system("poetry run isort tests --settings-path pyproject.toml --profile black")
@task
def test(c, verbose=False, s=False):
flags = " ".join(["-vv" if verbose else "", "-s" if s else ""])
if os.system(f"poetry run pytest --cov={str(SRC_DIR)} --cov-report=xml {flags}") == 0:
os.system("poetry run coverage report")
os.system("poetry run coverage-badge -o coverage.svg -f")