fix: restore top-level import order
This commit is contained in:
@@ -6,7 +6,8 @@ from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
discord = pytest.importorskip("discord")
|
||||
pytest.importorskip("discord")
|
||||
import discord
|
||||
|
||||
from nanobot.bus.events import OutboundMessage
|
||||
from nanobot.bus.queue import MessageBus
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"""Tests for MCP HTTP probe guard (prevents event-loop crash on unreachable servers)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
import asyncio
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from nanobot.agent.tools.mcp import _probe_http_url, connect_mcp_servers
|
||||
from nanobot.agent.tools.registry import ToolRegistry
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _probe_http_url unit tests
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -101,6 +101,3 @@ async def test_probe_not_called_for_stdio():
|
||||
await connect_mcp_servers({"s": cfg}, registry)
|
||||
|
||||
assert not called, "probe should not be called for stdio transport"
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import fields
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from nanobot.agent.tools.base import Tool
|
||||
from nanobot.agent.tools.context import ToolContext
|
||||
from nanobot.agent.tools.loader import _SKIP_MODULES, ToolLoader
|
||||
|
||||
|
||||
class _MinimalTool(Tool):
|
||||
@@ -49,8 +52,6 @@ def test_tool_plugin_discoverable_default_is_true():
|
||||
|
||||
# --- ToolContext tests ---
|
||||
|
||||
from nanobot.agent.tools.context import ToolContext
|
||||
|
||||
|
||||
def test_tool_context_has_required_fields():
|
||||
field_names = {f.name for f in fields(ToolContext)}
|
||||
@@ -74,8 +75,6 @@ def test_tool_context_defaults():
|
||||
|
||||
# --- ToolLoader tests ---
|
||||
|
||||
from nanobot.agent.tools.loader import ToolLoader, _SKIP_MODULES
|
||||
|
||||
|
||||
def test_skip_modules_excludes_infrastructure():
|
||||
infra = {"base", "schema", "registry", "context", "loader", "config",
|
||||
@@ -140,8 +139,6 @@ def test_loader_registers_exec_with_real_tools_config(tmp_path):
|
||||
|
||||
# --- Task 4: _FsTool.create() ---
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_fs_tool_create_builds_from_context():
|
||||
from nanobot.agent.tools.filesystem import ReadFileTool
|
||||
@@ -258,7 +255,7 @@ def test_exec_tool_create():
|
||||
|
||||
|
||||
def test_web_tools_config_cls():
|
||||
from nanobot.agent.tools.web import WebSearchTool, WebFetchTool, WebToolsConfig
|
||||
from nanobot.agent.tools.web import WebFetchTool, WebSearchTool, WebToolsConfig
|
||||
assert WebSearchTool.config_key == "web"
|
||||
assert WebSearchTool.config_cls() is WebToolsConfig
|
||||
assert WebFetchTool.config_key == "web"
|
||||
@@ -347,7 +344,7 @@ def test_my_tool_enabled():
|
||||
|
||||
|
||||
def test_mcp_wrappers_not_discoverable():
|
||||
from nanobot.agent.tools.mcp import MCPToolWrapper, MCPResourceWrapper, MCPPromptWrapper
|
||||
from nanobot.agent.tools.mcp import MCPPromptWrapper, MCPResourceWrapper, MCPToolWrapper
|
||||
assert MCPToolWrapper._plugin_discoverable is False
|
||||
assert MCPResourceWrapper._plugin_discoverable is False
|
||||
assert MCPPromptWrapper._plugin_discoverable is False
|
||||
|
||||
Reference in New Issue
Block a user