Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions test/sdk/core/models/test_openai_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,10 @@ def __init__(self, *a, **k):
sys.modules["smolagents.models"] = sa_mod

_setup_stubs()
# Now that stubs are in place, attempt to execute the module so imports resolve to our stubs.
# If this early import fails, clean up the partial module so the later, properly-patched import can run.
try:
spec.loader.exec_module(openai_llm_module)
OpenAIModel = getattr(openai_llm_module, "OpenAIModel", None)
except Exception:
# Remove any partially-imported module to avoid interfering with later imports
if MODULE_NAME in sys.modules:
del sys.modules[MODULE_NAME]
OpenAIModel = None
# Do not execute the module here. The import below runs after the full mock
# graph is installed; importing it twice can initialise the real monitoring
# stack during collection and exhaust local resources.
OpenAIModel = None
Comment thread
WMC001 marked this conversation as resolved.


def make_chunk(content, reasoning=None, role=None):
Expand Down
Loading