2023-12-31 22:37:21 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
skip_openai = False
|
|
|
|
|
|
|
|
|
|
|
|
# Registers command-line option '--skip-openai' via pytest hook.
|
|
|
|
# When this flag is set, it indicates that tests requiring OpenAI should be skipped.
|
|
|
|
def pytest_addoption(parser):
|
|
|
|
parser.addoption("--skip-openai", action="store_true", help="Skip all tests that require openai")
|
|
|
|
|
|
|
|
|
|
|
|
# pytest hook implementation extracting the '--skip-openai' command line arg and exposing it globally
|
|
|
|
@pytest.hookimpl(tryfirst=True)
|
|
|
|
def pytest_configure(config):
|
|
|
|
global skip_openai
|
|
|
|
skip_openai = config.getoption("--skip-openai", False)
|
2024-01-20 09:06:29 -08:00
|
|
|
global skip_redis
|
|
|
|
skip_redis = config.getoption("--skip-redis", False)
|