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

CI tests the checkout's module, not the installed wheel

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

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
github-actions, python
Ambito
ci-cd, testing-qa

Direzione di ricerca

Inizia dal workflow dei test e dai suoi attuali comandi di installazione e pytest, quindi riproduci il controllo dell’importazione dalla root del repository. Verifica che il workflow testi il wheel installato, incluso un wheel senza ipython_pygments_lexers.py; il lavoro è completato quando il modulo mancante causa il fallimento dell’esecuzione dei test invece di farli passare usando la copia del checkout.

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

Descrizione

The tests workflow installs the project with python3 -m pip install "." pytest and then runs python3 -m pytest -v from the repository root. Because python -m puts the current directory first on sys.path, and the project is a single top-level module (ipython_pygments_lexers.py) next to its test file, the tests import ipython_pygments_lexers from the checkout rather than from the installed distribution. We observed this with an import probe in a clean container: in every run, the module was loaded from the working tree.

One consequence is that a packaging mistake in the wheel would not fail CI. To check, we built the wheel from the current main (50791e2) and made a copy of it with ipython_pygments_lexers.py removed. We then ran the tests from the repository root against each wheel (Python 3.12, pytest 9.1.1, pygments 2.21.0):

Command Intact wheel Wheel without the module
python -m pytest (the CI command) 7 passed 7 passed
pytest 7 passed 7 passed
pytest --import-mode=importlib 7 passed ImportError

Switching to the pytest entry point alone is not enough. With the default import mode, pytest inserts the test file's directory (the repository root) into sys.path, which again puts the checkout's module first.

If the intention is to test the installed package, running pytest --import-mode=importlib in the workflow makes the tests import the installed copy. If testing the checkout is intended, and the install is only there for the Pygments entry points, please feel free to close this.

We are studying how Python test suites pick the copy of the code they test, and wanted to share the observation.

Lingua principale
Python
Stelle
0
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 ipython/ipython-pygments-lexers

Tutte le issue di ipython/ipython-pygments-lexers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.