| Total Complexity | 5 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 2 | |||
| 3 | |||
| 4 | def pytest_addoption(parser): |
||
| 5 | parser.addoption( |
||
| 6 | "--run-online", |
||
| 7 | action="store_true", |
||
| 8 | default=False, |
||
| 9 | help="Run online tests", |
||
| 10 | ) |
||
| 11 | |||
| 12 | |||
| 13 | def pytest_collection_modifyitems(config, items): |
||
| 14 | if not config.getoption("--run-online"): |
||
| 15 | skipper = pytest.mark.skip(reason="Only run when --run-online is given") |
||
| 16 | for item in items: |
||
| 17 | if "online" in item.keywords: |
||
| 18 | item.add_marker(skipper) |
||
| 19 |