Tests: the Discord mirror tests pass on Windows #3610
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3610"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T19:27:56Z.
python -m unittest discover -s scripts -p "test_*.py", the run TESTING.md asks for on script changes, gives 8 errors on Windows onmain6bfb5c5. All are intest_discord_mirror, and CI does not see them because the mirror's workflow runs onubuntu-latest:UnicodeEncodeError: 'charmap' codec can't encode character U+200B(zero-width space). The sync log prints the posts, whose@escape is a zero-width space, and the Windows console encoding (cp1252) has no such character.test_nothing_is_written_when_the_state_cannot_be_saved:FileNotFoundError: shell not found: neither %ComSpec% nor %SystemRoot% is set.setUpclears the whole environment, so the shellbefore_first_writeruns cannot be found on Windows.What is in it
scripts/test_discord_mirror.py(tests only):setUpkeepsSYSTEMROOT/COMSPECwhen they are set, and sends the log to anio.StringIO(no test reads it).scripts/discord_mirror.pyis unchanged.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4at4a4ef436: 2904 passed, 0 failed, 51 ignored. SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same asmain.python -m unittest discover -s scripts -p "test_*.py": 66 tests OK (onmain: 66 run, 8 errors, the ones above).python -m unittest scripts/test_discord_mirror.py: OK 3 of 3 from Git Bash, once withPYTHONIOENCODING=utf-8, and once from Windows PowerShell 5.1.Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:23:59Z.
Review (head
4a4ef436, diff read, not a merge-check):No problems found in the diff. Checked that
setUpinscripts/test_discord_mirror.pynow keepsSYSTEMROOT/COMSPEConly when they are set, so theshell=Truecall inState.writing(scripts/discord_mirror.py~333) can findcmd.exe, and thatlog()(~52) looks upsys.stdouton every call, so theio.StringIOpatch catches the U+200B text fromescape(~114); no test asserts on that output.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:57:26Z.
merge-check
base:
1c8b551475head:
4a4ef436efmerge: clean (
git merge --no-editonto1c8b5514,git diff --checkclean;scripts/test_discord_mirror.py+4/-1)build: not run (Tier 0 Python script-test diff touching only
scripts/test_discord_mirror.py; no Rust code changed)tests:
python -m unittest -v scripts/test_discord_mirror.py-> 10 passed, 0 failed (on clean base1c8b5514: 9 passed, 1 error:FileNotFoundError: shell not found: neither %ComSpec% nor %SystemRoot% is set);python -m unittest discover -s scripts -p "test_*.py"-> 66 passed, 0 failed (base: 65 passed, 1 error). Rust workspace tests not run (Tier 0).review: Read the full diff (
scripts/test_discord_mirror.py:71-74, +4/-1). PreservingSYSTEMROOTandCOMSPEConly when present inos.environkeepsshell=Trueworking on Windows while remaining a no-op on POSIX, and patchingsys.stdouttoio.StringIO()avoids Windows console code-page encoding errors during test output. Clean, minimal, no regressions.performance: none (test-only change in
scripts/; zero runtime impact)verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:52:10Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by grathepic on 2026-12-03T02:01:05Z.
merge-check
base:
078358a058head:
4a4ef436efmerge: clean (
git diff --checkexit 0)build: not needed (Tier 0 Python script test change; no Rust files touched)
tests: on unmerged base
078358a0withPYTHONIOENCODING=cp1252:test_discord_mirror.py-> 2 passed, 8 errors (7UnicodeEncodeErroron\u200b+ 1FileNotFoundErrorintest_nothing_is_written_when_the_state_cannot_be_saved). On merged tree:PYTHONIOENCODING=cp1252python -m unittest discover -s scripts -p "test_discord_mirror.py" -v-> 10 passed, 0 failed;python -m unittest discover -s scripts -p "test_*.py" -v-> 85 passed, 0 failed. Rust workspace suite not run (Tier 0).title run: none (Tier 0 script-test change)
review: Read full diff (
scripts/test_discord_mirror.py, +4/-1) and verified the surrounding test file andscripts/discord_mirror.py. No findings.iois already imported; preservingSYSTEMROOTandCOMSPEConly when set inos.environletssubprocess.run(..., shell=True)resolvecmd.exeon Windows while remaining a no-op on POSIX; patchingsys.stdouttoio.StringIO()catcheslog()'sprint(..., flush=True)without affecting any assertions (no test reads stdout);scripts/discord_mirror.pyis unchanged. All CI checks are green. Not tested: Linux runner (no-op there since those env vars are unset).performance: none (test-only change in
scripts/)verdict: safe to merge
hardware / tool and model: AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Python 3.12.3 / Antigravity, Gemini 4 Neon