-
Notifications
You must be signed in to change notification settings - Fork 7
/
tasks.py
58 lines (42 loc) · 1.14 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
import sys
from invoke import task
@task
def benchmark(c):
"""CI benchmark"""
c.run("pytest --benchmark-only")
@task
def black(c):
c.run(f"{sys.executable} -m black --check h5grove/ example/ test/")
@task
def flake8(c):
c.run(f"{sys.executable} -m flake8 -v")
@task
def mypy(c):
c.run(f"{sys.executable} -m mypy h5grove/ example/ test/")
@task
def lint(c):
"""Lint"""
black(c)
flake8(c)
mypy(c)
@task(optional=["verbose", "keyword", "cov-lines"])
def test(c, verbose=False, keyword="", cov_lines=False):
"""Test without benchmark"""
c.run(
"pytest --benchmark-skip"
+ (" -vv" if verbose else "")
+ (f" -k{keyword}" if keyword else "")
+ (" --cov-report term-missing" if cov_lines else "")
)
@task
def docbuild(c):
"""Sphinx build"""
result = c.run(f"{sys.executable} -m sphinx -W -b html docs _build")
if result.exited != 0:
raise SystemExit(result.exited)
@task
def doc(c):
"""Sphinx autobuild"""
result = c.run(f"{sys.executable} -m sphinx_autobuild -W -b html docs _build")
if result.exited != 0:
raise SystemExit(result.exited)