a | b/Tests/conftest.py | ||
---|---|---|---|
1 | import pytest |
||
2 | |||
3 | |||
4 | def pytest_addoption(parser): |
||
5 | parser.addoption( |
||
6 | "--runslow", action="store_true", default=False, help="run slow tests" |
||
7 | ) |
||
8 | |||
9 | |||
10 | def pytest_collection_modifyitems(config, items): |
||
11 | if config.getoption("--runslow"): |
||
12 | # --runslow given in cli: do not skip slow tests |
||
13 | return |
||
14 | skip_slow = pytest.mark.skip(reason="need --runslow option to run") |
||
15 | for item in items: |
||
16 | if "slow" in item.keywords: |
||
17 | item.add_marker(skip_slow) |