| from __future__ import annotations | |
| import pytest | |
| def pytest_addoption(parser): | |
| parser.addoption( | |
| "--live-api", | |
| action="store_true", | |
| default=False, | |
| help="run tests that call external provider APIs", | |
| ) | |
| def pytest_collection_modifyitems(config, items): | |
| if config.getoption("--live-api"): | |
| return | |
| skip_live = pytest.mark.skip(reason="live API test; re-run with --live-api to enable") | |
| for item in items: | |
| if "live_api" in item.keywords: | |
| item.add_marker(skip_live) | |