-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
19 lines (17 loc) · 948 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def pytest_addoption(parser):
parser.addoption('--large', action='store_true', dest="large",
default=False, help="Run tests decorated with 'large' annotation")
parser.addoption("--requires-ssh", action='store_true', dest="requires_ssh",
default=False, help="Run tests decorated with 'requires_ssh' annotation. "
"These tests require keys to be configured locally "
"for SSH authentication.")
def pytest_configure(config):
# Override the markexpr argument to pytest
# See https://docs.pytest.org/en/latest/example/markers.html for more details
markexpr = []
if not config.option.large:
markexpr.append('not large')
if not config.option.requires_ssh:
markexpr.append('not requires_ssh')
if len(markexpr) > 0:
setattr(config.option, 'markexpr', " and ".join(markexpr))