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