mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(guardrails): pin the discovery cache by behavior instead of object identity
This commit is contained in:
parent
c196aa6f4d
commit
409b402553
1 changed files with 9 additions and 4 deletions
|
|
@ -102,11 +102,16 @@ def test_the_next_lookup_retries_a_package_that_failed_to_import():
|
|||
assert not llms_package.guardrail_translation_discovery.unavailable
|
||||
|
||||
|
||||
def test_a_complete_discovery_is_cached():
|
||||
first = llms_package.load_guardrail_translation_mappings()
|
||||
second = llms_package.load_guardrail_translation_mappings()
|
||||
def test_a_complete_discovery_is_not_scanned_again():
|
||||
healthy = llms_package.load_guardrail_translation_mappings()
|
||||
|
||||
assert first is second
|
||||
assert CallTypes.acompletion in healthy
|
||||
|
||||
with unimportable(OPENAI_CHAT_TRANSLATION_MODULE):
|
||||
after_the_package_breaks = llms_package.load_guardrail_translation_mappings()
|
||||
|
||||
assert CallTypes.acompletion in after_the_package_breaks
|
||||
assert not llms_package.guardrail_translation_discovery.unavailable
|
||||
|
||||
|
||||
def test_a_package_that_keeps_failing_is_reported_once_and_its_recovery_announced(caplog):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue