-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtasks.py
More file actions
50 lines (43 loc) · 1.22 KB
/
tasks.py
File metadata and controls
50 lines (43 loc) · 1.22 KB
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 pathlib
import subprocess
from invoke import task
from ImageCompare import imagecompare
from ImageCompare import __version__ as VERSION
ROOT = pathlib.Path(__file__).parent.resolve().as_posix()
@task
def atests(context):
cmd = [
"coverage",
"run",
"--source=ImageCompare",
"-p",
"-m",
"robot",
"--loglevel=TRACE:DEBUG",
f"{ROOT}/atest",
]
subprocess.run(" ".join(cmd), shell=True, check=False)
@task(atests)
def tests(context):
subprocess.run("coverage combine", shell=True, check=False)
subprocess.run("coverage report", shell=True, check=False)
subprocess.run("coverage html", shell=True, check=False)
@task
def libdoc(context):
print(f"Generating libdoc for library version {VERSION}")
target = f"{ROOT}/docs/imagecompare.html"
cmd = [
"python",
"-m",
"robot.libdoc",
"-n ImageCompare",
f"-v {VERSION}",
"ImageCompare",
target,
]
subprocess.run(" ".join(cmd), shell=True, check=False)
@task
def readme(context):
with open(f"{ROOT}/docs/README.md", "w", encoding="utf-8") as readme:
doc_string = imagecompare.__doc__
readme.write(str(doc_string))