改动 / #3240

#3240 [Other] tests: test_winjob reads tasklist in the console's OEM code page (#2331)

open · @Buddychek · 0 评论 · 去 GitHub 看

Server & APIWindows

说明

### Problem and result

Two gaps in `serve/test_winjob.py`:

1. On a non-English Windows console the test decoded `tasklist` output as text, and the console's OEM code page mangled it (#2331).
2. `TestNoThrottle` was defined after `unittest.main()`, so `python serve/test_winjob.py` ran only 2 of the 3 classes; the module form ran all 3.

After: the test reads `tasklist`'s bytes in the console's OEM code page, and the `main()` call sits at the file end, so the file form runs 3/3 like the module form already did. Test-only change.

### Related discussion

Closed in the 0.2.0-beta tracker reset; rebased on main and re-verified per the reset note. #2331 is the OEM code-page report this fixes.

### Approach

Read `tasklist` output as bytes and decode with the console OEM code page; move `unittest.main()` to the file end.

### Validation

Passed, rebased on 0.2.0-beta main (`e88ee39d`), Windows 11 (German locale), Python 3.15:

- `python serve/test_winjob.py` → 3/3 OK, exit 0.
- `python -m unittest serve.test_winjob` → 3/3 OK, exit 0.

Not run: CI; English-locale consoles (the OEM decode is locale-independent by construction).

### Limits

Test-only; no change to the job-object code under test.

本站相关内容

相关页面的快捷入口。