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

Does not consult files at project root

Aperta
#692 1 commento 1 reazione 0 assegnatari Vedi su GitHub

@DawnofGenX ci sta già lavorando.

Dal 6/10/2026.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Start by reproducing the configuration and .coverage differences from the project root and from ./tests/, using the listed pytest, pytest-cov, and coverage versions. Trace how pytest-cov locates pyproject.toml and chooses the coverage output path; done means both invocations use the project-root configuration and place .coverage consistently.

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

Descrizione

Summary

If pytest runs in e.g. ./tests/, it reads ../pyproject.toml for configuration options, and that squares with my expectation. pytest-cov does seem to look only for ./pyproject.toml (and also writes ./.coverage instead of keeping that file at the project root), and that causes it to run with different settings depending on where pytest is invoked.

Case in point, I have this in my config:

[tool.coverage.report]
exclude_also = [
  'def __repr__',
]

If I run pytest from the project root directory, I get 100% coverage. If I run it from the tests/ subdirectory, all __repr__ functions, which I don't test, get reports as uncovered.

Reproducer

Versions

pytest                       8.3.5
pytest-cov                   6.1.1
coverage                     7.8.0

Python 3.13.3

Lingua principale
Python
Stelle
2.1k
Fork
253
Merge medio
12g 4h
PR unite (30g)
4

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-cov

Tutte le issue di pytest-dev/pytest-cov

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.