Skip to content

Conversation

@Chesars
Copy link
Contributor

@Chesars Chesars commented Nov 9, 2025

Title

fix: Add mock_testing to Presidio unit tests and fix enterprise base_email imports

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

✅ Test

Changes

Summary

Fixes 2 failing unit tests that were missed in recent test cleanup:

  • 2 Presidio guardrail tests
  • 18 enterprise base_email tests

Changes

1. Presidio Tests (Unit Tests)

Added mock_testing=True to 2 test functions that were creating _OPTIONAL_PresidioPIIMasking directly instead of using the presidio_guardrail fixture.

Files changed:

  • tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py

Tests fixed:

  • test_presidio_sets_guardrail_information_in_request_data
  • test_request_data_flows_to_apply_guardrail

Why this fix: Without mock_testing=True, the Presidio class tries to validate PRESIDIO_ANALYZER_API_BASE environment variable which isn't needed for unit tests.

2. Enterprise Email Tests

Changed absolute imports to relative imports in base_email.py to use local code instead of package.

Files changed:

  • enterprise/litellm_enterprise/enterprise_callbacks/send_emails/base_email.py
  • tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_base_email.py

Tests fixed:

  • All 18 tests in test_base_email.py

The litellm-enterprise==0.1.20 package in site-packages is outdated and missing SendKeyRotatedEmailEvent. Using relative imports ensures main code is used.

Testing

# Presidio tests
poetry run pytest tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py::test_presidio_sets_guardrail_information_in_request_data -v
poetry run pytest tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py::test_request_data_flows_to_apply_guardrail -v
# 2 passed

Enterprise email tests

poetry run pytest tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_base_email.py -v
# 18 passed

Note for Maintainers

⚠️ The litellm-enterprise package (v0.1.20) in pyproject.toml is outdated. Consider updating it to include recent additions like SendKeyRotatedEmailEvent.

…ase_email

- Add mock_testing=True to 2 Presidio tests to avoid requiring PRESIDIO_ANALYZER_API_BASE
- Change absolute imports to relative imports in enterprise base_email.py
- Fix test imports to use enterprise. prefix for proper resolution

Root cause: litellm-enterprise==0.1.20 package in site-packages is outdated
compared to local code. Using relative imports ensures local code is used.

Tests fixed:
- test_presidio_sets_guardrail_information_in_request_data
- test_request_data_flows_to_apply_guardrail
- All 18 tests in test_base_email.py
@vercel
Copy link

vercel bot commented Nov 9, 2025

@Chesars is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

…lParams

- Added rewrite_query field to VectorStoreToolParams dataclass
- Updated to_dict() method to include rewrite_query
- Fixes ImportError when importing VectorStoreToolParams
- Ensures all VECTOR_STORE_OPENAI_PARAMS are included in the dataclass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant