Skip to content

[CI] 缺少测试工作流,main 测试基线长期为红 #146

Closed

Description

@Liears

问题描述

仓库里没有跑测试的 CI:.github/workflows/ 只有 build-desktop.yml(打 tag 时构建 PyInstaller 桌面包),push / PR 都不执行 pytest。结果是测试基线长期无人校验,main 上同时存在 16 项失败 + 1 项收集错误(见 #1 #3 #4)。

现状证据

$ echo "" | pytest tests -q
ERROR tests/test_history_compactor.py
!!! Interrupted: 1 error during collection !!!

$ pytest tests -q --ignore=tests/test_history_compactor.py
16 failed, 678 passed

其中一部分是套件内的顺序污染(单独跑绿、全量跑红),只有全量执行才能暴露:

  • tests/rag/test_retriever.py::test_sync_embeds_changed_doc(全量跑失败,单独跑通过)
  • tests/test_mcp_auth_retry.py::test_401_retried_exactly_once(同上)

建议

新增 .github/workflows/tests.yml:

  • 触发:push 到 main + 所有 pull_request;
  • 矩阵:ubuntu-latest 必跑;windows-latest 建议同时跑(本仓库目标平台明显包含 Windows,桌面版就是 PyInstaller 打包);
  • 步骤:actions/setup-python@v5(3.11/3.12)→ pip install -r requirements.txt pytest pytest-asyncio → python -m pytest tests -q。

顺带两个建议(可另开 issue):

  1. 前端类型检查未纳入构建:frontend/package.json 里有 type-check 和 build:check,但 build 只跑 vite build;npm run type-check 当前有 60 处既有错误(未使用变量、window.pywebview 缺类型等)。建议清理后把 vue-tsc 加进 CI,而不是让 build:check 继续闲置。
  2. 测试依赖没有声明:pytest / pytest-asyncio 不在任何 requirements 里,需要手写安装命令;建议补 requirements-dev.txt。

环境信息

  • OS: Windows 11 / Python 3.12.10
  • CountBot: main @ c89b3ec

Activity

  1. Liears commented on Nov 1, 2026

    @Liears
    ContributorAuthor

    PR #151 已合并(522c222),tests.yml 随 main 生效。这条 issue 是因为合并提交里没有 Fixes #146 关键字而没有被自动关闭,手动关掉。

    当前状态:

    • Tests 工作流在 ubuntu-latest 与 windows-latest 上运行,最近一次 main 运行(40993060097,合并 fix(tools): 取消 exec 时终止整棵进程树(Windows) #152 之后)两条腿都是 success。
    • 首次在 main 上跑时 Windows 那条腿挂了一条 tests/test_tool_boundaries.py::test_exec_terminates_process_on_cancel(TimeoutError),由 fix(tools): 取消 exec 时终止整棵进程树(Windows) #152 定位并修复:Windows 上取消 exec 只结束了 cmd.exe,sleep.exe 成为孤儿继续持有管道,导致取消后的读取挂到超时。这正是加 CI 的价值——POSIX 上永远看不到。
    • 本机(Windows 11 / Python 3.12.10,main @ 2223ce8)python -m pytest tests -q → 708 passed。

    剩下未纳入 CI 的部分仍建议单独跟进:frontend 的 type-check 有 60 处既有错误,build 只跑 vite build。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions