From 284b303fa8ede40d111bf2d2668f5bda5519944d Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sun, 6 Sep 2026 21:36:23 +0000 Subject: [PATCH] test: e2e conftest imports GatewayRunner at module level; elicitation test docstring matches the default thunk Same cleanup as the previous commit, applied to the third file that carried the TYPE_CHECKING + in-function import pair. gateway.run imports none of the telegram/discord/ slack modules the conftest stubs, so import order is not a concern. test_feishu.py keeps its TYPE_CHECKING import on purpose (FeishuAdapter is gated on optional lark_oapi). --- tests/e2e/conftest.py | 9 ++------- tests/tools/test_mcp_elicitation.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index 577d0c13e2..bcfe192751 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -12,19 +12,16 @@ No LLM, no real platform connections. import asyncio import sys import uuid -from typing import TYPE_CHECKING from datetime import datetime, timezone from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock, patch import pytest -if TYPE_CHECKING: - from gateway.run import GatewayRunner - from gateway.config import GatewayConfig, Platform, PlatformConfig from gateway.platforms.base import SendResult from gateway.platforms.event import MessageEvent +from gateway.run import GatewayRunner from gateway.session import SessionEntry, SessionSource, build_session_key E2E_MESSAGE_SETTLE_DELAY = 0.3 @@ -169,13 +166,11 @@ def make_event( ) -def make_runner(platform: Platform, session_entry: SessionEntry = None) -> "GatewayRunner": +def make_runner(platform: Platform, session_entry: SessionEntry = None) -> GatewayRunner: """Create a GatewayRunner with mocked internals for e2e testing. Skips __init__ to avoid filesystem/network side effects. """ - from gateway.run import GatewayRunner - if session_entry is None: session_entry = make_session_entry(platform) diff --git a/tests/tools/test_mcp_elicitation.py b/tests/tools/test_mcp_elicitation.py index edc05bb4da..1177c0f5fd 100644 --- a/tests/tools/test_mcp_elicitation.py +++ b/tests/tools/test_mcp_elicitation.py @@ -250,7 +250,7 @@ class TestElicitationHandlerContextBridge: ) def test_missing_captured_context_falls_back_to_direct_call(self): - """Without a call_context (or one whose task hasn't entered a tool + """With the default call_context (or one whose task has not entered a tool call) the handler must still invoke the consent router -- just without the contextvar replay. Otherwise CLI/TUI sessions, which don't set HERMES_SESSION_PLATFORM, would break."""