-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtasks.py
More file actions
59 lines (53 loc) · 1.75 KB
/
tasks.py
File metadata and controls
59 lines (53 loc) · 1.75 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
51
52
53
54
55
56
57
58
59
import pathlib
import subprocess
from invoke import task
import inspect
if not hasattr(inspect, 'getargspec'):
inspect.getargspec = inspect.getfullargspec
ROOT = pathlib.Path(__file__).parent.resolve().as_posix()
utests_completed_process = None
atests_completed_process = None
@task
def utests(context):
cmd = [
"coverage",
"run",
"--source=src/SelfHealing",
"-p",
"-m",
"pytest",
"--junitxml=results/pytest.xml",
f"{ROOT}/tests/utest",
]
global utests_completed_process
utests_completed_process = subprocess.run(" ".join(cmd), shell=True, check=False)
@task
def atests(context):
cmd = [
"coverage",
"run",
"--source=src/SelfHealing",
"-p",
"-m",
"robot",
"--loglevel=TRACE:DEBUG",
"--listener RobotStackTracer",
"--exclude appiumORnot_readyORnot_ci",
"-d results",
"--prerebotmodifier utilities.xom.XUnitOut:results/xunit.xml",
f"{ROOT}/tests/atest"
]
global atests_completed_process
atests_completed_process = subprocess.run(" ".join(cmd), shell=True, check=False)
@task(utests, atests)
def tests(context):
subprocess.run("coverage combine", shell=True, check=False)
subprocess.run("coverage report", shell=True, check=False)
subprocess.run("coverage html -d results/htmlcov", shell=True, check=False)
if utests_completed_process.returncode != 0 or atests_completed_process.returncode != 0:
raise Exception("Tests failed")
@task
def coverage_report(context):
subprocess.run("coverage combine", shell=True, check=False)
subprocess.run("coverage report", shell=True, check=False)
subprocess.run("coverage html -d results/htmlcov", shell=True, check=False)