pytest.ini wins even when it's empty, and `.pytest.ini` is never read

Aperta Adatta ai principianti
#159 0 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
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, typescript

Direzione di ricerca

Inizia leggendo readPytestSettings e PROJECT_FILES, poi cerca i test con fixture sintetici descritti in CONTRIBUTING.md. Aggiungi un fixture in cui un pytest.ini vuoto ha la precedenza su pyproject.toml e un altro in cui .pytest.ini configura python_files; esegui npm test. Il lavoro è concluso quando entrambi i casi passano e .pytest.ini da solo viene rilevato come progetto Python.

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

Descrizione

adapter bug good first issue

pytest's rule: pytest.ini "will always match and take precedence … even if empty", and it matches even without a [pytest] section. The hidden .pytest.ini works the same way. Only pyproject.toml, tox.ini and setup.cfg need their section to match. The first match wins, and options are never merged.

readPytestSettings skips any file without the section (if (!section) continue;) and never looks at .pytest.ini. So:

  • With a pytest.ini that has only a comment, plus a pyproject.toml that sets python_files = ["check_*.py"], DiffCI uses check_*.py. pytest uses its defaults, test_*.py and *_test.py. DiffCI then doesn't see test_x.py as a test.
  • With only a .pytest.ini that sets python_files = check_*.py, DiffCI uses the defaults and doesn't see check_x.py as a test.

Done when:

  • The search order is pytest.ini, .pytest.ini, then pyproject.toml, tox.ini and setup.cfg.
  • An existing pytest.ini or .pytest.ini stops the search, even without a [pytest] section. pytest's defaults apply when it has no section.
  • .pytest.ini is added to PROJECT_FILES, so a repository whose only pytest file is .pytest.ini is detected as a Python project.
  • There is a test for each of the two cases above.

New to DiffCI? See CONTRIBUTING.md: add a synthetic fixture, run npm test, and sign off commits with git commit -s. Comment here to claim the issue.

Lingua principale
TypeScript
Stelle
0
Fork
4
Merge medio
18h 41m
PR unite (30g)
48

Preparare l'ambiente

Apri in Codespaces

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

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 DiffCI/core

Tutte le issue di DiffCI/core

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.