diff --git a/tests/e2e/budgets/test_budget_crud_e2e.py b/tests/e2e/budgets/test_budget_crud_e2e.py index 7e0c614638d..e697eca0051 100644 --- a/tests/e2e/budgets/test_budget_crud_e2e.py +++ b/tests/e2e/budgets/test_budget_crud_e2e.py @@ -38,6 +38,7 @@ def test_budget_crud_roundtrip(client: BudgetClient, resources: ResourceManager) def test_budget_delete_removes_it(client: BudgetClient, resources: ResourceManager) -> None: budget_id = client.create_budget(max_budget=1.0) + resources.defer(lambda: client.delete_budget(budget_id)) client.delete_budget(budget_id) assert not client.budget_info(budget_id), "budget still present after delete" diff --git a/tests/e2e/budgets/test_soft_budget_e2e.py b/tests/e2e/budgets/test_soft_budget_e2e.py index 85ff0c25792..407de7ae467 100644 --- a/tests/e2e/budgets/test_soft_budget_e2e.py +++ b/tests/e2e/budgets/test_soft_budget_e2e.py @@ -28,8 +28,8 @@ def test_soft_budget_does_not_block( result = client.chat( key, "claude-haiku-4-5", f"hi {unique_marker()}", max_tokens=16 ) - require_successful_call(result) # skip if provider unavailable assert not is_budget_block(result), ( "soft_budget blocked a request; it must alert only, not block " f"(body={result.body[:200]})" ) + require_successful_call(result) # any other non-2xx (e.g. provider down) is a hard fail diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index 1fa67acbce8..953a11f9ca2 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -32,14 +32,20 @@ def pytest_configure(config: pytest.Config) -> None: def pytest_sessionfinish(session: pytest.Session, exitstatus: int) -> None: """Once the whole e2e session is done (all suites), truncate the spend logs so the DB doesn't accumulate test rows. Best-effort: a cleanup failure (no DB - reachable) must not fail the run.""" - sys.path.insert(0, str(Path(__file__).parent / "spend_tracking")) + reachable) must not fail the run. The spend_tracking dir goes on sys.path only + for this import and is removed after, so a broader `pytest tests/` run is not + left with a mutated path.""" + spend_dir = str(Path(__file__).parent / "spend_tracking") + sys.path.insert(0, spend_dir) try: from spend_e2e_client import reset_spend_logs # pyright: ignore reset_spend_logs() except Exception as exc: # noqa: BLE001 - cleanup is best-effort print(f"spend-log cleanup skipped: {exc}") + finally: + if spend_dir in sys.path: + sys.path.remove(spend_dir) @pytest.fixture(scope="session", autouse=True) diff --git a/tests/e2e/gateway/litellm-config.yml b/tests/e2e/gateway/litellm-config.yml index d8f93d0d930..769f2a91818 100644 --- a/tests/e2e/gateway/litellm-config.yml +++ b/tests/e2e/gateway/litellm-config.yml @@ -61,14 +61,6 @@ litellm_settings: # service_callback: ["datadog"] callbacks: ["arize_phoenix", "datadog", "smtp_email", "prometheus", "otel"] require_auth_for_metrics_endpoint: false - cache: true - cache_params: - type: redis - host: redis - port: 6379 - password: os.environ/REDIS_PASSWORD - namespace: litellm.caching - ttl: 16600 #type: redis-semantic #similarity_threshold: 0.8 # similarity threshold for semantic cache #redis_semantic_cache_embedding_model: text-embedding-ada-002 # only works with text-embedding-ada-002 for now... https://github.com/BerriAI/litellm/issues/4001