forked from dh-nunes/pyfomod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
46 lines (32 loc) · 862 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
import webbrowser
from pathlib import Path
import pytest
from invoke import task
ROOT_FOLDER = Path(__file__).resolve().parent
@task
def isort(c):
c.run("isort -m 3 -tc -fgw 0 -up -w 88 -rc src/pyfomod tests tasks.py")
@task
def black(c):
c.run("black src/pyfomod tests tasks.py")
@task
def flake(c):
c.run(
"flake8 --max-line-length=80 --select=C,E,F,W,B,B950 "
"--ignore=B305,E203,E501,E731,W503 src/pyfomod tests tasks.py"
)
@task(pre=[isort, black, flake])
def check(c):
pass
@task
def test(c):
pytest.main(["-rsx", "tests/"])
@task
def docs(c, open=False):
docs_folder = ROOT_FOLDER / "docs"
with c.cd(str(docs_folder)):
c.run("make html")
c.run("make linkcheck")
if open:
html_path = docs_folder / "_build" / "html" / "index.html"
webbrowser.open(html_path)