forked from chmp/ipytest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
50 lines (36 loc) · 924 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
41
42
43
44
45
46
47
48
49
50
import os.path
from invoke import task
@task()
def format(c):
"""Format the code."""
c.run("black ipytest tests setup.py tasks.py")
@task()
def test(c):
"""Execute unit tests."""
c.run("py.test tests")
@task()
def integration(c):
"""Test ipytest - ipython integration."""
notebooks = [
"tests/TestIntegration.ipynb",
"tests/TestAsync.ipynb",
"Example.ipynb",
]
c.run("pytest --nbval-lax " + " ".join(notebooks))
@task()
def docs(c):
"""Render the documentation."""
try:
from chmp.tools.mddocs import transform_file
except ImportError:
raise RuntimeError("Need chmp installed to create docs")
self_path = os.path.dirname(__file__)
transform_file(
os.path.join(self_path, "Readme.in"), os.path.join(self_path, "Readme.md")
)
@task()
def precommit(c):
format(c)
docs(c)
test(c)
integration(c)