| 1 |
# pytest configuration |
| 2 |
|
| 3 |
import pytest |
| 4 |
|
| 5 |
|
| 6 |
def pytest_addoption(parser): |
| 7 |
parser.addoption( |
| 8 |
"--run-slow", action="store_true", default=False, help="run slow tests" |
| 9 |
) |
| 10 |
|
| 11 |
|
| 12 |
def pytest_configure(config): |
| 13 |
config.addinivalue_line("markers", "slow: mark test as slow to run") |
| 14 |
|
| 15 |
|
| 16 |
def pytest_collection_modifyitems(config, items): |
| 17 |
if not config.getoption("--run-slow"): |
| 18 |
# without --run-slow option: skip all slow tests |
| 19 |
skip_slow = pytest.mark.skip(reason="need --run-slow option to run") |
| 20 |
for item in items: |
| 21 |
if "slow" in item.keywords: |
| 22 |
item.add_marker(skip_slow) |