fix: improve VCR configuration and skip local service tests in CI

- Update VCR config to exclude body matching for more reliable cassette playback
- Add pytest marker for tests requiring local services (Ollama, etc)
- Configure CI to skip tests marked as requiring local services
- Re-record async tool test cassettes with telemetry calls only
This commit is contained in:
Greyson LaLonde
2025-09-26 22:30:34 -04:00
parent 76ad0e0a10
commit 0a09beca03
3 changed files with 6 additions and 3 deletions

View File

@@ -84,7 +84,8 @@ jobs:
$DURATIONS_ARG \
--durations=10 \
-n auto \
--maxfail=3
--maxfail=3 \
-m "not requires_local_services"
- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'

View File

@@ -156,6 +156,7 @@ exclude_dirs = ["src/crewai/cli/templates"]
[tool.pytest.ini_options]
markers = [
"telemetry: mark test as a telemetry test (don't mock telemetry)",
"requires_local_services: mark test as requiring local services like Ollama (skip in CI)",
]
[[tool.uv.index]]

View File

@@ -162,11 +162,12 @@ def mock_opentelemetry_components():
@pytest.fixture(scope="module")
def vcr_config(request) -> dict:
import os
# In CI, use once mode to fail if cassette doesn't exist
# In CI, use none mode to never record new requests
# Locally, use new_episodes to record new cassettes
record_mode = "once" if os.getenv("CI") else "new_episodes"
record_mode = "none" if os.getenv("CI") else "new_episodes"
return {
"cassette_library_dir": "tests/cassettes",
"record_mode": record_mode,
"filter_headers": [("authorization", "AUTHORIZATION-XXX")],
"match_on": ["method", "scheme", "host", "port", "path", "query"],
}