Skip to content
Open
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
14 changes: 14 additions & 0 deletions tests/test_verdicts_et_commun_separes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import annotations

import os
import subprocess
from pathlib import Path

Expand All @@ -23,13 +24,25 @@
OUTIL = RACINE / "tests" / "outils" / "verdicts_et_commun_separes.py"


def _env_sans_git() -> dict[str, str]:
# Lance depuis un hook de commit, ce test herite de GIT_DIR et de
# GIT_INDEX_FILE. Dans un worktree, ces chemins sont ABSOLUS et visent le
# vrai depot : `git init`, `git config` et `git add -A` du depot jetable
# ecrivaient alors dans sa configuration (core.bare, identite « Banc ») et
# remplacaient l'index du worktree, et l'outil lisait l'index du worktree
# au lieu de celui du depot jetable. Constate le 2026-10-31. Sans ces
# variables, git ne voit que le depot jetable.
return {k: v for k, v in os.environ.items() if not k.startswith("GIT_")}


def _git(depot: Path, *args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
["git", "-C", str(depot), *args],
check=True,
capture_output=True,
text=True,
timeout=30,
env=_env_sans_git(),
)


Expand Down Expand Up @@ -72,6 +85,7 @@ def _jouer(depot: Path) -> subprocess.CompletedProcess[str]:
capture_output=True,
text=True,
timeout=30,
env=_env_sans_git(),
)


Expand Down