diff --git a/scripts/validate-install-docs.py b/scripts/validate-install-docs.py index a1d05611..95453f72 100755 --- a/scripts/validate-install-docs.py +++ b/scripts/validate-install-docs.py @@ -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 diff --git a/tests/scripts/test_validate_install_docs.py b/tests/scripts/test_validate_install_docs.py index 169a2993..6bb2edbb 100644 --- a/tests/scripts/test_validate_install_docs.py +++ b/tests/scripts/test_validate_install_docs.py @@ -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,