mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(test): restore default_internal_user_params to None instead of delattr
test_role_mappings_override_default_internal_user_params was calling delattr(litellm, 'default_internal_user_params') in its finally block when the original value was None. This removes the attribute entirely from the module, causing subsequent tests in the same xdist worker to get AttributeError when accessing litellm.default_internal_user_params (because litellm.__getattr__ has no handler for this name). Fix: always restore the attribute by assignment (litellm.default_internal_user_params = original_default_params) rather than deleting it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3ea8d32d81
commit
77d1f6932e
1 changed files with 4 additions and 6 deletions
|
|
@ -3682,12 +3682,10 @@ async def test_role_mappings_override_default_internal_user_params():
|
|||
# The models will be applied when new_user processes the request
|
||||
|
||||
finally:
|
||||
# Restore original default_internal_user_params
|
||||
if original_default_params is not None:
|
||||
litellm.default_internal_user_params = original_default_params
|
||||
else:
|
||||
if hasattr(litellm, "default_internal_user_params"):
|
||||
delattr(litellm, "default_internal_user_params")
|
||||
# Restore original default_internal_user_params (always assign, never delattr —
|
||||
# deleting the attribute causes AttributeError in subsequent tests because
|
||||
# litellm.__getattr__ has no handler for this name)
|
||||
litellm.default_internal_user_params = original_default_params
|
||||
|
||||
|
||||
class TestSSOReadinessEndpoint:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue