Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

helper_lib test assumes the system temporary directory is outside a Git worktree

Aperta Adatta ai principianti
#920 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Inizia con test_git_root_search_not_found nella suite di test di helper_lib (target //src/helper_lib:helper_lib_tests), poi leggi l'implementazione di get_runfiles_dir() in helper_lib per vedere come funziona la sua ricerca degli antenati contenenti .git. La correzione è nel test: isola o fai il mock del confine di ricerca della radice (ad es. patchando la directory di partenza o la funzione di ricerca) in modo che il ramo senza radice Git venga raggiunto indipendentemente dalla disposizione di /tmp sull'host. Si è completati quando il test passa su un host in cui un antenato di tmp_path contiene .git, e bazel test --lockfile_mode=error //src/helper_lib:helper_lib_tests è verde.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

test_git_root_search_not_found creates nowhere beneath pytest’s tmp_path and expects get_runfiles_dir() to fail because no .git ancestor exists. That assumption does not hold when the system temporary directory itself is inside a Git worktree.

On a Linux host where /tmp/.git exists, the test walks from /tmp/pytest-of-.../nowhere to /tmp, treats /tmp as the Git root, and then follows the runfiles fallback instead of raising SystemExit with Could not find git root. The target therefore fails even though the production behavior is consistent with its ancestor search.

Reproduction

  1. Run the helper-library tests on a host with a Git marker at an ancestor of pytest’s temporary directory (for example /tmp/.git).
  2. Run bazel test --lockfile_mode=error //src/helper_lib:helper_lib_tests.
  3. Observe test_git_root_search_not_found fail because the expected no-root branch is not reached.

This was reproduced while validating #919; 24 of 25 Bazel targets passed, with this target as the only failure.

Expected behavior

The test should deterministically exercise the no-Git-root path regardless of the host temporary-directory layout, for example by isolating or mocking the root search boundary rather than relying on tmp_path having no .git ancestor.

Lingua principale
Python
Stelle
11
Fork
35
Merge medio
1g 6h
PR unite (30g)
72

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di eclipse-score/docs-as-code

Tutte le issue di eclipse-score/docs-as-code

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.