forked from opsdroid/opsdroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
34 lines (28 loc) · 1.07 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
import pytest
def pytest_addoption(parser):
parser.addoption(
"--only-signal-tests",
action="store_true",
default=False,
help=(
"run tests that test OpsDroid signal handling. "
"When --only-signal-tests is not specified, signal tests are skipped. "
"When --only-signal-tests is specified, all other tests are skipped."
),
)
def pytest_configure(config):
config.addinivalue_line(
"markers",
"isolate_signal_test: mark test as a signal test that requires isolation",
)
def pytest_collection_modifyitems(config, items):
if config.getoption("--only-signal-tests"):
# don't report all other tests as skipped, just ignore them
items[:] = [item for item in items if "isolate_signal_test" in item.keywords]
else:
skip_signal_tests = pytest.mark.skip(
reason="need --only-signal-tests option to run"
)
for item in items:
if "isolate_signal_test" in item.keywords:
item.add_marker(skip_signal_tests)