fix(ci): keep install-docs help cp1252-safe

This commit is contained in:
dajiaohuang
2026-09-05 05:17:34 +08:00
parent f2302e8c95
commit 2594abebf8
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ Markers:
Normalisation (per RESEARCH Pitfall #4):
- rstrip trailing whitespace
- normalise CRLF LF
- normalise CRLF -> LF
- strip `$ ` and `>>> ` REPL/prompt prefixes
- skip blank lines + lines that are only `#` comments
@@ -21,6 +21,8 @@ the tests don't depend on the real repo state.
from __future__ import annotations
import importlib.util
import os
import subprocess
import sys
from pathlib import Path
@@ -52,6 +54,19 @@ def _make_root(tmp_path: Path, *, docs: dict[str, str], script: str) -> Path:
return tmp_path
def test_help_is_safe_for_cp1252_consoles():
env = os.environ.copy()
env["PYTHONIOENCODING"] = "cp1252"
result = subprocess.run(
[sys.executable, str(SCRIPT_PATH), "--help"],
check=False,
capture_output=True,
env=env,
)
assert result.returncode == 0, result.stderr.decode("ascii", errors="replace")
def test_clean_state_passes(validator_module, tmp_path, capsys):
root = _make_root(
tmp_path,