-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconftest.py
42 lines (35 loc) · 1.17 KB
/
conftest.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
# -*- coding: utf-8 -*-
collect_ignore = ["setup.py"]
def pytest_addoption(parser):
parser.addoption(
"--stress",
action="store_true",
dest="stress",
default=False,
help="Enable stress tests",
)
parser.addoption(
"--optional",
action="store_true",
dest="optional",
default=False,
help="Enable optional tests",
)
parser.addoption(
"--applications",
action="store_true",
dest="applications",
default=False,
help="Enable application tests",
)
def pytest_configure(config):
# Add non-standard markers
config.addinivalue_line("markers", "stress: long running stress tests")
config.addinivalue_line("markers", "optional: optional tests")
config.addinivalue_line("markers", "applications: application tests")
markexpr = [config.option.markexpr] if config.option.markexpr else []
for mark in ("stress", "optional", "applications"):
test = "" if getattr(config.option, mark, False) else "not "
markexpr.append(f"{test}{mark}")
config.option.markexpr = " and ".join(markexpr)
print(config.option.markexpr)