-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.py
More file actions
35 lines (27 loc) · 763 Bytes
/
commands.py
File metadata and controls
35 lines (27 loc) · 763 Bytes
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
from runcommands import command
from runcommands.commands import local as _local
@command
def format_code(check=False):
_local(f"black . {'--check' if check else ''}")
@command
def lint():
_local("flake8 .")
@command
def test(with_coverage=True, check=True, fail_fast=False):
if with_coverage:
_local(
"coverage run "
"--source src/jsun "
"-m unittest discover "
"-t . -s tests "
"&& coverage report"
)
else:
fail_fast = "-f" if fail_fast else ""
_local(f"python -m unittest discover -t . -s tests {fail_fast}")
if check:
format_code(check=True)
lint()
@command
def tox(clean=False):
_local(f"tox {'-r' if clean else ''}")