forked from kplabs-pl/ESA-ADB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
27 lines (19 loc) · 832 Bytes
/
Copy pathconftest.py
File metadata and controls
27 lines (19 loc) · 832 Bytes
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
import pytest
options = {"docker": "mark test to run with docker installed",
"dask": "mark test to run with dask installed and being able to SSH itself."}
def pytest_addoption(parser):
for option in options.keys():
parser.addoption(
f"--{option}", action="store_true", default=False, help=f"run also {option} tests"
)
def pytest_configure(config):
for option, desc in options.items():
config.addinivalue_line("markers", f"{option}: {desc} ")
def pytest_collection_modifyitems(config, items):
for option in options.keys():
if config.getoption(f"--{option}"):
continue
skip = pytest.mark.skip(reason=f"need --{option} option to run")
for item in items:
if option in item.keywords:
item.add_marker(skip)