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

Using frame inspection to obtain feature file path is unreliable

Aperta
#401 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Inizia tracciando l’ispezione dei frame di pytest-bdd e il modo in cui la cache dei moduli con assert riscritti di pytest fornisce i percorsi dei file delle feature. Riproduci il problema eseguendo i test in /projects/my-project/tests, quindi in un container Docker montato in /app/my-project. Il lavoro è completato quando i metadati nella cache non indirizzano più pytest-bdd al percorso obsoleto e il FileNotFoundError viene evitato.

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

Descrizione

Pytest-bdd uses frame inspection to obtain the path to its feature file. This in unreliable because

Pytest performs assert rewriting, and caches the rewritten modules. If I run pytest-bdd on my local system, where my tests are in "/projects/my-project/tests", then the cached rewritten modules will end up containing this path in their metadata.

If I then spin up a docker container, with my project mounted as "/app/my-project", then when I run my tests, pytest will load the cached rewritten modules, and the metadata will be wrong. This usually doesn't matter, but it matters to pytest-bdd, because pytest-bdd will get the wrong path, and go looking for its feature file in "/projects/my-project/tests/....", and crash with a FileNotFoundError.

Lingua principale
Python
Stelle
1.5k
Fork
252
Merge medio
2h 8m
PR unite (30g)
5

Preparare l'ambiente

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 pytest-dev/pytest-bdd

Tutte le issue di pytest-dev/pytest-bdd

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.