DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

[Feature Request]: Run the Python test suite on Windows CI (136 tests fail on Windows today)

Open NishilRathod opened this issue 1 month ago • 0 comments

Checklist

  • [X] I have searched the existing feature request and this feature request is not already filed.
  • [X] I believe this is a legitimate feature request, not just a question or bug.

Feature Request Description

Run the Python test suite (tests/ and deeptutor/learning/tests) on a windows-latest runner in CI.

Today the main suite only runs on ubuntu-24.04; on Windows, CI runs only the desktop-shell job in tests.yml and the memory tests in memory-evaluation.yml. On Windows 11 (Python 3.12, dev at f7aed074, installed as the developer guide says: requirements/full.txt, pip install -e . --no-deps, scripts/install_extras.py dev):

python -m pytest tests deeptutor/learning/tests
136 failed, 11996 passed, 154 skipped in 2132s

Most of the 136 are tests that assume Linux, but a few point at real Windows bugs in product code, which is the kind of thing a Windows lane would catch before a release.

Product bugs (reproduced)

  1. scripts/install_extras.py crashes when its output is redirected. Line 146 prints a 📦 emoji; under the default cp1252 code page that raises UnicodeEncodeError and the script exits 1 before installing anything, although its docstring says it is never fatal. Same class as #702 and #398. PYTHONIOENCODING=utf-8 works around it.
  2. The workspace write probe reports a long path as a permissions problem. WorkspaceService._ensure_ready (deeptutor/services/workspace/service.py) creates …/outputs/.deeptutor-write-probe-<uuid>. With DEEPTUTOR_WORKSPACE_ROOT set, the probe path under outputs/.deeptutor/chat/<owner>/workspaces/<id>/outputs/ reached ~272 characters, over Windows' 260-character MAX_PATH. The resulting FileNotFoundError is reported as "The workspace outputs folder is not writable." Default desktop roots are shorter, so this mostly bites deep custom roots (and the tests).

Likely product bugs (found reading the failures, not reproduced end to end yet)

  1. WorkspaceCatalogMixin.assert_available (deeptutor/services/workspace/catalog.py:471) probes the migrating process with os.kill(pid, 0). On Windows signal 0 is CTRL_C_EVENT, and a dead pid raises OSError (WinError 87) rather than ProcessLookupError, so a stale migration marker is never cleared. deeptutor/runtime/process.py:is_process_alive already handles this case and could be reused.
  2. The CLI-app installer runs env_dir / "bin" / "python" (deeptutor/services/cli_apps/installer.py:209) and bin_dir() returns venv/bin (paths.py:72). On Windows a venv puts these in Scripts\, so installing a Python CLI app would fail at the pip step, unless CLI apps are meant to be Linux-only.

Test-side causes

Tests Cause Examples
26 POSIX executables (/usr/bin/env python3, /bin/echo) services/sandbox/test_argv_exec.py
17 read_text() / open() with no encoding= → cp1252 UnicodeDecodeError test_packaging_metadata.py (11), notes/test_block_pages.py, services/test_task_models.py
15 Creating symlinks needs admin or Developer Mode (WinError 1314) api/test_output_files.py, api/test_render_storage.py
11 Fake environments built with the POSIX venv layout (bin/, lib/pythonX.Y/site-packages) plugins/test_lifecycle.py, plugins/test_recovery_boundaries.py, services/cli_apps/test_installer.py
11 POSIX process control: os.killpg, SIGKILL/SIGTERM escalation, taskkill arguments modules/test_render_cancellation.py, runtime/test_launcher.py, runtime/test_launcher_lifecycle.py
10 Paths over MAX_PATH under pytest's temp dir (7 of them are bug 2) app/test_lost_ack_resend_reuses_session.py, multi_user/test_kb_move.py
7 os.kill(pid, 0) as a liveness probe (WinError 87) modules/test_worker_stream.py
7 / separators or a :-joined PATH expected in assertions api/test_subagents_router.py, services/cli_apps/test_provider.py, tools/builtin/test_read_skill_tool.py
3 POSIX permission bits (0o700, owner-only files) services/cli_apps/test_state_and_paths.py, services/mcp/test_oauth.py
1 File still open when the test removes it (WinError 32) services/workspace/test_data_migration.py
1 Case-insensitive filesystem (MAIN.TEX is found) tools/test_tex_tools.py
1 ~16 ms time.monotonic() resolution services/embedding/test_client_runtime.py
26 Not triaged one by one yet (Invidious account flow, memory snapshot adapters, capability contracts, exec tool, PocketBase ordering, SQLite migration, …)

Counts come from grouping tracebacks by their error, so a few could move between rows on a closer look.

Use Case

Windows is a shipped platform (the desktop shell is already built and tested on windows-latest), and Windows users run the same Python backend. Encoding and path problems like #702 and #398 have so far been found by users after release; a Windows lane would catch that class in CI, and keep new tests from quietly assuming Linux.

Related Module

Other

Additional Context

I'm on Windows and happy to do this in small PRs against dev:

  1. Test portability only, no product changes: encoding="utf-8", sys.executable instead of /usr/bin/env python3, a skip when symlinks can't be created, skipif for POSIX-only process and permission tests, and platform-correct fake venvs. That should clear roughly 100 of the 136.
  2. The product bugs above, one PR each with a test that fails first.
  3. The CI job: a windows-latest job running the suite, non-blocking (or with a short known-failures list) until it is green, then required. The full run took about 35 minutes here, so running it on pushes to dev or nightly may be a better start than on every PR.

Would you take this? And do you have a preference for the trigger, and for blocking vs. non-blocking at first?

Triage was done with help from Claude Code (AI). Counts come from the pytest logs, and the product-code items were checked against the source at f7aed074.

NishilRathod avatar Nov 02 '26 07:11 NishilRathod