Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
e58a561
Merge pull request #27906 from BerriAI/litellm_internal_staging
shin-berri May 14, 2026
a72414a
Merge pull request #28100 from BerriAI/litellm_internal_staging
yuneng-berri May 17, 2026
4254c4a
fix(tests): stabilize image-edit VCR cassettes to stop live gpt-image…
mateo-berri May 17, 2026
ba3915d
DIAGNOSTIC: log VCR body mismatches + per-episode body hashes
mateo-berri May 17, 2026
85430bc
DIAGNOSTIC: route VCR diagnostics through per-PID files (bypass xdist…
mateo-berri May 17, 2026
8e08272
fix(tests): coalesce iterable request bodies before matching/recording
mateo-berri May 17, 2026
9e2e5b6
fix(tests): handle bytes_iterator + never leave an exhausted body
mateo-berri May 17, 2026
1c51ad1
fix(tests): clear vcrpy's sticky _was_iter flag so materialized bodie…
mateo-berri May 17, 2026
927c554
revert(tests): drop the temp per-episode body-hash diagnostic
mateo-berri May 17, 2026
c7d6d4d
chore(tests): delete unused flush script + wire VCR diagnostic dump e…
mateo-berri May 17, 2026
78ada20
chore(tests): trim non-essential comments per project comment policy
mateo-berri May 17, 2026
a3c36f0
chore(tests): forward **kwargs in pin_httpx_multipart_boundary wrapper
mateo-berri May 17, 2026
6e3d4b0
chore(tests): canonicalize VCR matchers and surface shouldn't-happen …
mateo-berri May 17, 2026
32369ed
chore(tests): symmetrize diag-log cleanup across every VCR-using conf…
mateo-berri May 17, 2026
1957d6d
fix(tests): gate body materialization on __next__ and strip PR comments
mateo-berri May 17, 2026
8021e60
HACK: one-shot redis flush of corrupted presidio cassettes
mateo-berri May 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(tests): symmetrize diag-log cleanup across every VCR-using conf…
…test

``image_gen_tests/conftest.py`` was the only suite that cleared
``test-results/vcr-diagnostics/*.log`` at session start. The other 12
VCR-using conftests inherited any stale per-PID logs from a previous
local run and would dump them in the terminal summary -- harmless in
CI (fresh container) but confusing locally when running multiple
suites in sequence.

Extracts the cleanup into a ``reset_vcr_diag_dir`` helper in
``tests/_vcr_conftest_common.py`` and calls it from every VCR-using
conftest's ``pytest_configure``. Same single source of truth, no
inline duplication.
  • Loading branch information
mateo-berri committed May 17, 2026
commit 32369edb8faa367b8f0f216a4bc797ff3e06d2ec
24 changes: 24 additions & 0 deletions tests/_vcr_conftest_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ def vcr_diag_write_line(msg: str) -> None:
pass


def reset_vcr_diag_dir() -> None:
"""Delete any leftover per-PID diagnostic logs from a previous session.

No-op when running on an xdist worker -- the controller does the
cleanup once and the workers inherit the (now-empty) directory.
Safe to call from any conftest's ``pytest_configure``.
"""
if os.environ.get("PYTEST_XDIST_WORKER"):
return
directory = _vcr_diag_dir()
if not os.path.isdir(directory):
return
try:
names = os.listdir(directory)
except OSError:
return
for name in names:
if name.endswith(".log"):
try:
os.remove(os.path.join(directory, name))
except OSError:
pass


def emit_vcr_diagnostic_log(terminalreporter) -> None:
directory = _vcr_diag_dir()
if not os.path.isdir(directory):
Expand Down
2 changes: 2 additions & 0 deletions tests/audio_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -45,6 +46,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/guardrails_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -56,6 +57,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
12 changes: 2 additions & 10 deletions tests/image_gen_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from tests._vcr_conftest_common import ( # noqa: E402
VerboseReporterState,
_vcr_diag_dir,
apply_vcr_auto_marker_to_items,
emit_cassette_cache_session_banner,
emit_vcr_classification_summary,
Expand All @@ -20,6 +19,7 @@
pin_httpx_multipart_boundary,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -69,15 +69,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
if not os.environ.get("PYTEST_XDIST_WORKER"):
directory = _vcr_diag_dir()
if os.path.isdir(directory):
for name in os.listdir(directory):
if name.endswith(".log"):
try:
os.remove(os.path.join(directory, name))
except OSError:
pass
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/litellm_utils_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -87,6 +88,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/llm_responses_api_testing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -53,6 +54,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/llm_translation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -74,6 +75,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/local_testing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -85,6 +86,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/logging_callback_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -80,6 +81,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/ocr_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -52,6 +53,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/pass_through_unit_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -57,6 +58,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/router_unit_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -98,6 +99,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/search_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -53,6 +54,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
2 changes: 2 additions & 0 deletions tests/unified_google_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
install_live_call_probe,
record_vcr_outcome,
register_persister_if_enabled,
reset_vcr_diag_dir,
vcr_config_dict,
)

Expand Down Expand Up @@ -85,6 +86,7 @@ def _vcr_outcome_gate(request, vcr):

def pytest_configure(config):
_verbose_state.remember_pluginmanager(config)
reset_vcr_diag_dir()


def pytest_runtest_logreport(report):
Expand Down
Loading