From b29e0c6c8733ae72a06f201e92f64622823a57ad Mon Sep 17 00:00:00 2001 From: eatmoreduck Date: Tue, 15 Sep 2026 15:03:30 +0800 Subject: [PATCH] test(caching): skip the disk round trip when the optional diskcache extra is absent The default CI test environment does not install litellm[caching], so the disk parametrization raised ModuleNotFoundError there. importorskip keeps the coverage wherever the extra is present and skips cleanly otherwise. --- .../caching/test_cache_provider_specific_fields.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_litellm/caching/test_cache_provider_specific_fields.py b/tests/test_litellm/caching/test_cache_provider_specific_fields.py index 02813176100..8826a9ac4de 100644 --- a/tests/test_litellm/caching/test_cache_provider_specific_fields.py +++ b/tests/test_litellm/caching/test_cache_provider_specific_fields.py @@ -41,6 +41,11 @@ def _make_response_with_citations() -> ModelResponse: @pytest.mark.parametrize("cache_type", ["local", "disk"]) def test_cache_round_trip_preserves_provider_specific_fields(cache_type, tmp_path): + if cache_type == "disk": + # DiskCache is an optional extra (`litellm[caching]`); the default CI + # test environment does not install it, so exercise that path only + # where the dependency is present. + pytest.importorskip("diskcache") litellm.cache = Cache(type=cache_type, disk_cache_dir=str(tmp_path / "litellm_cache")) try: kwargs = {