Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion PythonScripts/audit_translations/auditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,17 @@ 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])
audit_cli.main()
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")

Expand Down Expand Up @@ -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,
Expand Down