From 94d6707bf5f1f3500d8dc7cad5119b46e64e05da Mon Sep 17 00:00:00 2001 From: EMRG Evolution Date: Wed, 5 Aug 2026 17:17:13 +0800 Subject: [PATCH] =?UTF-8?q?emrg:=20=E5=90=AF=E7=94=A8=20Windows=20CI=20?= =?UTF-8?q?=E7=BA=AF=E9=80=BB=E8=BE=91=20TUI=20=E6=B5=8B=E8=AF=95=20?= =?UTF-8?q?=E2=80=94=20=E7=A7=BB=E9=99=A4=2065=20=E4=B8=AA=E8=BF=87?= =?UTF-8?q?=E6=97=B6=20skipif=20+=20=E4=BF=AE=E6=AD=A3=203=20=E5=A4=84?= =?UTF-8?q?=E8=BF=87=E6=97=B6=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #401 (R123) 后 Windows 已有原生 TUI(Win32Console raw mode + stdin/resize 线程化), terminal.py 的 termios/fcntl/tty import 有 None 保护,python_tui 包在 Windows 可安全 import。 历史遗留问题:6 个测试文件仍带 'TUI is POSIX-only (fcntl/termios)' 的过时 skipif, 导致 Windows 构建(build-release.yml regression gate 在 windows-2025 跑 pytest)跳过 65 个纯逻辑测试——buffer 写入/ANSI 生成/输入解析逻辑在 Windows 上完全无回归保障。 改动: 1. test_buffer/test_output/test_input_parser(65 测试):移除 skipif——纯逻辑、无平台调用、 import 链安全,Windows CI 将实际执行 2. test_app_widgets/test_daemon_manager/test_daemon_manager_e2e:保留 skip(交互/daemon 生命周期依赖 POSIX 终端/进程语义),但注释更新为准确原因(不再声称 POSIX-only) 验证:470 passed(macOS 全量回归)+ import OK + --help OK --- tests/test_app_widgets.py | 5 +++-- tests/test_buffer.py | 6 ------ tests/test_daemon_manager.py | 6 ++++-- tests/test_daemon_manager_e2e.py | 6 ++++-- tests/test_input_parser.py | 6 ------ tests/test_output.py | 6 ------ 6 files changed, 11 insertions(+), 24 deletions(-) diff --git a/tests/test_app_widgets.py b/tests/test_app_widgets.py index 86933a77..7ce5c642 100644 --- a/tests/test_app_widgets.py +++ b/tests/test_app_widgets.py @@ -5,8 +5,9 @@ import sys import pytest -# TUI (python_tui) 依赖 POSIX-only fcntl/termios/tty——Windows 跳过(Windows 冒烟不跑 TUI) -pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="TUI is POSIX-only (fcntl/termios)") +# R123 (#401) 后 Windows 已有原生 TUI(Win32Console),但 app.py 交互测试依赖 +# 终端输入/信号行为(SIGWINCH/raw mode),Windows CI 冒烟阶段不可靠 → 仍跳过。 +pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="app 交互测试依赖 POSIX 终端行为(SIGWINCH/raw mode)") from emrg.client.python_tui.widgets.base import Line, RenderContext, Span, Widget from emrg.client.app import ProjectSelector, ModelSelector diff --git a/tests/test_buffer.py b/tests/test_buffer.py index de83c096..13efac12 100644 --- a/tests/test_buffer.py +++ b/tests/test_buffer.py @@ -8,12 +8,6 @@ from __future__ import annotations -import sys -import pytest - -# TUI (python_tui) 依赖 POSIX-only fcntl/termios/tty——Windows 跳过(Windows 冒烟不跑 TUI) -pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="TUI is POSIX-only (fcntl/termios)") - from rich.style import Style from emrg.client.python_tui.buffer import Buffer, Cell, CellWidth, write_lines_to_buffer diff --git a/tests/test_daemon_manager.py b/tests/test_daemon_manager.py index 10eec195..6f1d73cd 100644 --- a/tests/test_daemon_manager.py +++ b/tests/test_daemon_manager.py @@ -16,8 +16,10 @@ import sys -# TUI (python_tui) 依赖 POSIX-only fcntl/termios/tty——Windows 跳过(Windows 冒烟不跑 TUI) -pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="TUI is POSIX-only (fcntl/termios)") +# R123 (#401) 后 Windows 已有原生 TUI,但 daemon_manager 测试覆盖 daemon 生命周期 +# (spawn/信号/超时语义),Windows 上 CREATE_NEW_PROCESS_GROUP 等行为与 POSIX 不同 +# → Windows CI 冒烟阶段仍跳过(纯逻辑测试见 test_buffer/test_output/test_input_parser)。 +pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="daemon 生命周期测试依赖 POSIX 进程语义(Windows CI 冒烟不跑)") from emrg.client import daemon_manager diff --git a/tests/test_daemon_manager_e2e.py b/tests/test_daemon_manager_e2e.py index baf69e03..3f22528f 100644 --- a/tests/test_daemon_manager_e2e.py +++ b/tests/test_daemon_manager_e2e.py @@ -19,8 +19,10 @@ import sys -# TUI (python_tui) 依赖 POSIX-only fcntl/termios/tty——Windows 跳过(Windows 冒烟不跑 TUI) -pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="TUI is POSIX-only (fcntl/termios)") +# R123 (#401) 后 Windows 已有原生 TUI,但 e2e 测试 spawn 真实 daemon + asyncio +# 事件循环行为(ProactorEventLoop 无 add_reader)与 POSIX 差异大 → Windows CI +# 冒烟阶段仍跳过(纯逻辑测试见 test_buffer/test_output/test_input_parser)。 +pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="e2e 测试依赖 POSIX daemon spawn/事件循环语义(Windows CI 冒烟不跑)") from emrg.client import daemon_manager from tests.test_ws_e2e import _boot_server, _make_config, _make_fake_chat_stream diff --git a/tests/test_input_parser.py b/tests/test_input_parser.py index f856cdc5..9eedc632 100644 --- a/tests/test_input_parser.py +++ b/tests/test_input_parser.py @@ -1,11 +1,5 @@ """Tests for InputParser — byte-stream → complete key sequences, including UTF-8.""" -import pytest - -import sys - -# TUI (python_tui) 依赖 POSIX-only fcntl/termios/tty——Windows 跳过(Windows 冒烟不跑 TUI) -pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="TUI is POSIX-only (fcntl/termios)") from emrg.client.python_tui.events import InputParser, _utf8_len diff --git a/tests/test_output.py b/tests/test_output.py index e4cad8a0..2196b22a 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -7,12 +7,6 @@ from __future__ import annotations -import sys -import pytest - -# TUI (python_tui) 依赖 POSIX-only fcntl/termios/tty——Windows 跳过(Windows 冒烟不跑 TUI) -pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="TUI is POSIX-only (fcntl/termios)") - from rich.style import Style from emrg.client.python_tui.output import style_diff_sgr, style_to_sgr