diff --git a/tests/test_cli_e2e.py b/tests/test_cli_e2e.py index 5f5c0fc..56b207f 100644 --- a/tests/test_cli_e2e.py +++ b/tests/test_cli_e2e.py @@ -242,12 +242,18 @@ def _run_cli(*args, env=None): Uses ``sys.executable`` so the same interpreter that runs pytest runs the CLI. cwd is pinned to PROJECT_ROOT so the script's config-file auto-discovery (./searxng.toml) behaves deterministically. + + ``encoding="utf-8"`` is explicit because Windows Chinese systems default + to GBK for subprocess text decoding, which crashes on non-ASCII chars + in --help output (e.g. box-drawing chars, em-dashes). The script itself + already forces UTF-8 stdout via ``force_utf8_stdout()``, so this just + matches the decoding side. """ full_env = {**os.environ, **(env or {})} cmd = [sys.executable, str(PROJECT_ROOT / "scripts" / "search.py")] + list(args) return subprocess.run( cmd, cwd=str(PROJECT_ROOT), - capture_output=True, text=True, timeout=30, + capture_output=True, text=True, encoding="utf-8", timeout=30, env=full_env, )