Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai>
Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Guillaume LE GOFF 2026-06-12 13:16:04 +02:00 committed by GitHub
parent 702d0f412e
commit cafb6d4147
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
247 changed files with 12401 additions and 3029 deletions

View file

@ -351,6 +351,19 @@ class TestHasAgentsMdFile:
def test_agents_md_filename_constant(self) -> None:
assert AGENTS_MD_FILENAME == "AGENTS.md"
def test_unreadable_agents_md_does_not_crash(
self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
denied = (tmp_path / "AGENTS.md").resolve()
def fake_is_file(self: Path) -> bool:
if self.resolve() == denied:
raise PermissionError(13, "Permission denied")
return False
monkeypatch.setattr(Path, "is_file", fake_is_file)
assert has_agents_md_file(tmp_path) is False
class TestFindTrustableFiles:
def test_returns_empty_for_clean_directory(self, tmp_path: Path) -> None:
@ -513,3 +526,24 @@ class TestFindGitRepoAncestor:
) -> None:
monkeypatch.setattr(Path, "home", classmethod(lambda _cls: tmp_path / "nope"))
assert find_git_repo_ancestor(tmp_path) is None
def test_unreadable_ancestor_git_head_does_not_crash(
self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
ancestor = tmp_path / "mnt" / "vast"
(ancestor / ".git").mkdir(parents=True)
cwd = ancestor / "project"
cwd.mkdir()
real_is_file = Path.is_file
denied = (ancestor / ".git" / "HEAD").resolve()
def fake_is_file(self: Path) -> bool:
if self.resolve() == denied:
raise PermissionError(13, "Permission denied")
return real_is_file(self)
monkeypatch.setattr(Path, "is_file", fake_is_file)
monkeypatch.setattr(Path, "home", classmethod(lambda _cls: tmp_path / "home"))
assert find_git_repo_ancestor(cwd) is None