Add n kwarg being ignored workaround

This commit is contained in:
dmahan93 2025-05-12 12:06:03 -05:00
parent 706097db21
commit 1aa72d7e7e
4 changed files with 208 additions and 4 deletions

View file

@ -0,0 +1,23 @@
import pytest
def pytest_addoption(parser):
parser.addoption(
"--runproviders", action="store_true", default=False, help="run provider tests"
)
def pytest_configure(config):
config.addinivalue_line(
"markers", "providers: mark test as requires providers api keys to run"
)
def pytest_collection_modifyitems(config, items):
if config.getoption("--runproviders"):
# --runproviders given in cli: do not skip slow tests
return
skip_providers = pytest.mark.skip(reason="need --runproviders option to run")
for item in items:
if "providers" in item.keywords:
item.add_marker(skip_providers)