CI tests the checkout's module, not the installed wheel
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 70/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- github-actions, python
- Bereich
- ci-cd, testing-qa
Rechercherichtung
Beginne mit dem Tests-Workflow und seinen aktuellen Installations- und pytest-Befehlen und führe dann die Importprüfung aus dem Repository-Root aus. Verifiziere, dass der Workflow das installierte Wheel testet, einschließlich eines Wheels ohne ipython_pygments_lexers.py; als erledigt gilt dies, wenn das fehlende Modul dazu führt, dass der Testlauf fehlschlägt, statt gegen die Checkout-Kopie erfolgreich zu sein.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 0
- Forks
- 2
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ipython/ipython-pygments-lexers
-
failure on shell commands after `%%time`Evtl. vergeben @ump45nose hat das vor 23 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
Alle Issues in ipython/ipython-pygments-lexers
Ähnliche Issues
-
Quantized sample scoring and slicing discard the configured epsilon gapEvtl. vergeben @sylvesterkaczmarek hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
google-deepmind/distrax#364 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 66/100
suitenumerique/conversations#798 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
fabriziosalmi/certmate#1207 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[work-item] adam-adae-onset-emergence: document the minute-precision datetime coercion (ASTTMF not derivable)Evtl. vergeben @muse-yamaa-bot hat das heute übernommen. Offenwork-item
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag