You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

conftest.py 1.1 kB

1234567891011121314151617181920212223242526
  1. import pytest
  2. skip_openai = False
  3. skip_redis = False
  4. skip_docker = False
  5. MOCK_OPEN_AI_API_KEY = "sk-mockopenaiAPIkeyinexpectedformatfortestingonly"
  6. # Registers command-line options like '--skip-openai' and '--skip-redis' via pytest hook.
  7. # When these flags are set, it indicates that tests requiring OpenAI or Redis (respectively) should be skipped.
  8. def pytest_addoption(parser):
  9. parser.addoption("--skip-openai", action="store_true", help="Skip all tests that require openai")
  10. parser.addoption("--skip-redis", action="store_true", help="Skip all tests that require redis")
  11. parser.addoption("--skip-docker", action="store_true", help="Skip all tests that require docker")
  12. # pytest hook implementation extracting command line args and exposing it globally
  13. @pytest.hookimpl(tryfirst=True)
  14. def pytest_configure(config):
  15. global skip_openai
  16. skip_openai = config.getoption("--skip-openai", False)
  17. global skip_redis
  18. skip_redis = config.getoption("--skip-redis", False)
  19. global skip_docker
  20. skip_docker = config.getoption("--skip-docker", False)