mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
test(lazy_imports): capture globals() before the star-import audit comprehension
The subprocess-level star-import audit called dir() inside a list comprehension, which returns the comprehension's own scope on CPython 3.10/3.11/3.13/3.14 (and only accidentally exposed the module globals on 3.12), so every name in litellm.__all__ registered as missing and misc / Run tests failed on those matrix cells. Snapshot globals() into a local before the comprehension so the audit always sees the module-level bindings that from litellm import * just created. Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
parent
a0c9095cfc
commit
9dfd3122dc
1 changed files with 2 additions and 1 deletions
|
|
@ -408,7 +408,8 @@ def test_star_import_exports_public_api():
|
|||
code = (
|
||||
"from litellm import *\n"
|
||||
"import litellm\n"
|
||||
"missing = [n for n in litellm.__all__ if n not in dir()]\n"
|
||||
"bound = globals()\n"
|
||||
"missing = [n for n in litellm.__all__ if n not in bound]\n"
|
||||
"assert not missing, missing[:20]\n"
|
||||
"assert callable(completion) and callable(Router)\n"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue