JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
修改检视问题
yt20264669e71ea03f
diff --git a/examples/custom_extension_tool.py b/examples/custom_extension_tool.pyindex efb4a6e71d..c73bf50431 100644--- a/examples/custom_extension_tool.py+++ b/examples/custom_extension_tool.py@@ -29,7 +29,6 @@ import asyncioimport contextvarsimport jsonimport logging-from typing import Anyfrom openjiuwen.core.foundation.tool import Tool, tooldiff --git a/tests/unit_tests/agentserver/test_extra_tools_env.py b/tests/unit_tests/agentserver/test_extra_tools_env.pyindex b65bb4882f..494ca47042 100644--- a/tests/unit_tests/agentserver/test_extra_tools_env.py+++ b/tests/unit_tests/agentserver/test_extra_tools_env.py@@ -12,9 +12,10 @@ from __future__ import annotationsimport asyncioimport contextvars-import importlib+import importlib.utilimport loggingimport pathlib+import sysfrom concurrent.futures import ThreadPoolExecutorfrom typing import Anyfrom uuid import uuid4@@ -127,7 +128,14 @@ def _write_tool_module(body: str,) -> str:"""Write an importable module into ``tmp_path`` and return its import name."""- (tmp_path / f"{name}.py").write_text(body, encoding="utf-8")+ source = tmp_path / f"{name}.py"+ source.write_text(body, encoding="utf-8")+ # Module names are reused across tests with different bodies. Drop the+ # stale sys.modules entry AND the cached bytecode: the .pyc header stores+ # mtime with second granularity, so a same-size rewrite in the same second+ # would otherwise pass staleness validation and re-import the old code.+ sys.modules.pop(name, None)+ pathlib.Path(importlib.util.cache_from_source(source)).unlink(missing_ok=True)monkeypatch.syspath_prepend(str(tmp_path))return name