-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconftest.py
More file actions
30 lines (24 loc) · 881 Bytes
/
conftest.py
File metadata and controls
30 lines (24 loc) · 881 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
28
29
30
# The code here has been borrowed from the examples given here:
# https://docs.pytest.org/en/latest/example/simple.html
import pytest
def pytest_addoption(parser):
parser.addoption(
"--run-slow",
action="store_true",
default=False,
help="run tests marked as slow",
)
def pytest_configure(config):
slow_info = "slow: mark test as slow to run"
neg_info = "negative: marks tests that test invalid input"
config.addinivalue_line("markers", slow_info)
config.addinivalue_line("markers", neg_info)
def pytest_collection_modifyitems(config, items):
if config.getoption("--run-slow"):
return
skipped = pytest.mark.skip(
reason="slow tests are skipped by default; to run, call pytest with --run-slow."
)
for item in items:
if "slow" in item.keywords:
item.add_marker(skipped)