How VCR test recording and replay works
mainChatlas uses pytest-recording (wrapping vcrpy) to manage HTTP interactions during tests.
How it works:
- Recording: During a test run, VCR captures HTTP requests and responses and saves them as YAML files called "cassettes" in the
tests/_vcr/directory. - Replay: On subsequent runs, VCR intercepts the HTTP calls and returns the saved responses from the cassettes instead of making live network requests.
Benefits:
- Fast CI: Tests run without network latency.
- No secrets in CI: Replay mode uses dummy API keys, so real credentials aren't needed in CI environments.
- Deterministic tests: Ensures the same response is received every time, preventing flakiness caused by changing model outputs or network issues.