CI tests the checkout's module, not the installed wheel
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 70/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- github-actions, python
- Domaine
- ci-cd, testing-qa
Piste de recherche
Commencez par le workflow de tests et ses commandes actuelles d’installation et de pytest, puis reproduisez la vérification de l’import depuis la racine du dépôt. Vérifiez que le workflow teste le wheel installé, y compris un wheel sans ipython_pygments_lexers.py ; c’est terminé lorsque l’absence du module provoque l’échec de l’exécution des tests au lieu de réussir contre la copie du checkout.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 0
- Forks
- 2
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de ipython/ipython-pygments-lexers
-
failure on shell commands after `%%time`Peut-être pris @ump45nose l’a pris il y a 22 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
Toutes les issues de ipython/ipython-pygments-lexers
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 3 jours
-
Negation with "not" and "no" is ignored during sentiment analysisPeut-être pris @vivek-3728 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
techcsispit/mess-mood#11 · 1 commentaire ·
-
changelog investigate
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
ramnes/notion-sdk-py#408 ·
-
good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
btclib-org/btclib-wallet#267 ·
Les mainteneurs répondent en général sous 1 jour
-
good first issue tech-debt
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
knnmelprop/YAADO#111 ·