diff --git a/PythonScripts/audit_translations/auditor.py b/PythonScripts/audit_translations/auditor.py index 5df06b6fe..70ec179bd 100644 --- a/PythonScripts/audit_translations/auditor.py +++ b/PythonScripts/audit_translations/auditor.py @@ -66,7 +66,9 @@ def collect_from(directory: Path, root: Path) -> None: if region_dir: collect_from(region_dir, region_dir) - return sorted(files) + # sort by path parts (case-sensitive) so the order is the same on every platform; + # Windows paths compare case-insensitively + return sorted(files, key=lambda p: p.parts) def compare_files( diff --git a/PythonScripts/audit_translations/tests/test_cli_end_to_end.py b/PythonScripts/audit_translations/tests/test_cli_end_to_end.py index 7876bc0de..8b631f0dc 100644 --- a/PythonScripts/audit_translations/tests/test_cli_end_to_end.py +++ b/PythonScripts/audit_translations/tests/test_cli_end_to_end.py @@ -189,7 +189,9 @@ def test_cli_main_rich_output_matches_grouped_golden(capsys, monkeypatch) -> Non golden_path = Path(__file__).resolve().parent / "golden" / "rich" / "cli_calculus_verbose.golden" old_width = console.width + old_legacy_windows = console.legacy_windows console.width = 80 + console.legacy_windows = False # on Windows rich would otherwise replace the rounded box corners try: monkeypatch.setattr(sys, "argv", ["audit_translations", *args]) @@ -197,6 +199,7 @@ def test_cli_main_rich_output_matches_grouped_golden(capsys, monkeypatch) -> Non output = strip_ansi(capsys.readouterr().out) finally: console.width = old_width + console.legacy_windows = old_legacy_windows assert output == golden_path.read_text(encoding="utf-8") @@ -264,11 +267,13 @@ def test_cli_module_rich_output_groups_by_rule_and_type() -> None: env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join([str(python_scripts_dir), env.get("PYTHONPATH", "")]).strip(os.pathsep) env["COLUMNS"] = "80" + env["PYTHONIOENCODING"] = "utf-8" # output contains characters like "≠" that e.g. Windows code pages lack result = subprocess.run( [sys.executable, "-m", "audit_translations", *args], capture_output=True, text=True, + encoding="utf-8", cwd=str(python_scripts_dir), env=env, check=True,