-
Notifications
You must be signed in to change notification settings - Fork 1
/
pytest
64 lines (55 loc) · 2.02 KB
/
pytest
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
60
61
62
63
64
#! /usr/bin/env python
import pathlib
# Inherit the parent construction environment
Import("env")
build_directory = pathlib.Path(Dir(".").abspath)
# Limit list of source files to allow Conda build-test to test off the installed package
pytest_source_list = [
"pyproject.toml",
]
pytest_command = "cd ${package_dir} && pytest --junitxml=${TARGETS[0].abspath} -n 4 "
if env["unconditional_build"]:
pytest_command += " --unconditional-build"
target = ["test_results.xml"]
# TODO: Remove the "program_operations" logic when the race conditions on test_program_operations are fixed
coverage = ""
program_operations_coverage = ""
coverage_command = ""
if env["coverage_report"]:
coverage = "--cov"
program_operations_coverage = "--cov --cov-append"
target.append("coverage.xml")
coverage_command = "cd ${package_dir} && coverage xml -o ${TARGETS[1].abspath}"
pytest_node = env.Command(
target=target,
source=pytest_source_list,
action=[
"${pytest_command} -vvv -m \"not systemtest\" ${coverage}",
"${coverage_command}"
],
package_dir=env["package_dir"],
pytest_command=pytest_command,
coverage=coverage,
program_operations_coverage=program_operations_coverage,
coverage_command=coverage_command
)
env.Alias("pytest", pytest_node)
# Always run pytests in place of a complete source list
env.AlwaysBuild(pytest_node)
target = ["systemtest_results.xml"]
source = pytest_source_list + [str(pathlib.Path("waves/tests/test_system.py"))]
systemtest_node = env.Command(
target=target,
source=source,
action=[
"${pytest_command} -v --no-showlocals -m systemtest --tb=short --cache-clear --system-test-dir=${system_test_directory}"
],
package_dir=env["package_dir"],
pytest_command=pytest_command,
system_test_directory=build_directory
)
env.Alias("systemtest", systemtest_node)
env.AlwaysBuild(systemtest_node)
env.Clean(systemtest_node, [Dir(build_directory)])
# Collector alias to build all regression tasks
env.Alias("regression", pytest_node + systemtest_node)