fix(tests): Use uuid for unique model name in scientific notation test

The test was using a static "unique" model name which could cause
conflicts when running tests in parallel (-n 16 in CI). Using uuid
ensures truly unique names to prevent test pollution.
This commit is contained in:
Shin 2026-02-07 17:46:20 +00:00
parent 375e879e7c
commit 23140fab2f

View file

@ -2283,18 +2283,14 @@ def test_register_model_with_scientific_notation():
"""
Test that the register_model function can handle scientific notation in the model name.
"""
# Use a unique model name to avoid conflicts with other tests
test_model_name = "test-scientific-notation-model-unique-12345"
import uuid
# Clean up any pre-existing entry and clear caches
if test_model_name in litellm.model_cost:
del litellm.model_cost[test_model_name]
# Use a truly unique model name with uuid to avoid conflicts when tests run in parallel
test_model_name = f"test-scientific-notation-model-{uuid.uuid4().hex[:12]}"
# Clear LRU caches that might have stale data
from litellm.utils import (
_cached_get_model_info_helper,
_invalidate_model_cost_lowercase_map,
get_model_info,
)
_invalidate_model_cost_lowercase_map()