File size: 543 Bytes
66ad25b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)