|
44 | 44 | _inherited_doc_revert_base: str | None = None |
45 | 45 |
|
46 | 46 |
|
| 47 | +def git_environment() -> dict[str, str]: |
| 48 | + """Keep every fixture git subprocess's diagnostics in the C locale.""" |
| 49 | + env = os.environ.copy() |
| 50 | + env['LC_ALL'] = 'C.UTF-8' |
| 51 | + env.pop('LANGUAGE', None) |
| 52 | + return env |
| 53 | + |
| 54 | + |
47 | 55 | def setUpModule() -> None: |
48 | 56 | """Fixture repositories cannot resolve the caller's engine base.""" |
49 | 57 | global _inherited_doc_revert_base |
@@ -73,7 +81,7 @@ def __init__(self) -> None: |
73 | 81 |
|
74 | 82 | def git(self, *args: str) -> str: |
75 | 83 | return subprocess.run(['git', '-C', str(self.root), *args], capture_output=True, |
76 | | - text=True, check=True).stdout.strip() |
| 84 | + text=True, check=True, env=git_environment()).stdout.strip() |
77 | 85 |
|
78 | 86 | def commit(self, text: str, message: str, *, gate: bool = True) -> str: |
79 | 87 | self.page.write_text(text) |
@@ -348,7 +356,7 @@ def commit_page(self, r: Repo, text: str, message: str, |
348 | 356 | def conflict_with_main(self, r: Repo, lane: str, main: str) -> None: |
349 | 357 | result = subprocess.run( |
350 | 358 | ['git', '-C', str(r.root), 'merge', '--no-ff', '--no-commit', 'main'], |
351 | | - capture_output=True, text=True) |
| 359 | + capture_output=True, text=True, env=git_environment()) |
352 | 360 | self.assertEqual(result.returncode, 1, result.stdout + result.stderr) |
353 | 361 | self.assertIn('CONFLICT (content)', result.stdout + result.stderr) |
354 | 362 | self.assertEqual(r.git('rev-parse', 'HEAD'), lane) |
|
0 commit comments