mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
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:
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
@@ -84,7 +84,8 @@ jobs:
|
|||||||
$DURATIONS_ARG \
|
$DURATIONS_ARG \
|
||||||
--durations=10 \
|
--durations=10 \
|
||||||
-n auto \
|
-n auto \
|
||||||
--maxfail=3
|
--maxfail=3 \
|
||||||
|
-m "not requires_local_services"
|
||||||
|
|
||||||
- name: Save uv caches
|
- name: Save uv caches
|
||||||
if: steps.cache-restore.outputs.cache-hit != 'true'
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ exclude_dirs = ["src/crewai/cli/templates"]
|
|||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
markers = [
|
markers = [
|
||||||
"telemetry: mark test as a telemetry test (don't mock telemetry)",
|
"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]]
|
[[tool.uv.index]]
|
||||||
|
|||||||
@@ -162,11 +162,12 @@ def mock_opentelemetry_components():
|
|||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def vcr_config(request) -> dict:
|
def vcr_config(request) -> dict:
|
||||||
import os
|
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
|
# 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 {
|
return {
|
||||||
"cassette_library_dir": "tests/cassettes",
|
"cassette_library_dir": "tests/cassettes",
|
||||||
"record_mode": record_mode,
|
"record_mode": record_mode,
|
||||||
"filter_headers": [("authorization", "AUTHORIZATION-XXX")],
|
"filter_headers": [("authorization", "AUTHORIZATION-XXX")],
|
||||||
|
"match_on": ["method", "scheme", "host", "port", "path", "query"],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user