Python adapter test: interpreter probed twice can disagree on Windows (python3 vs python), failing CI at random

Ouverte Adaptée aux débutants
#304 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
78/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
github-actions, python, typescript
Domaine
ci-cd, testing-qa

Piste de recherche

Commencez par tests/repo/python-adapter.test.ts, en particulier par l’assertion sur l’interpréteur autour de la ligne 111, puis lisez src/repo/adapters/python.ts et la configuration de l’interpréteur dans le test autour de la ligne 70. Exécutez le test de l’adaptateur Python et vérifiez qu’il compare avec l’interpréteur enregistré pendant l’analyse ou, à défaut, qu’il tolère différents lanceurs Python 3 selon le répertoire de travail. Le travail est terminé lorsque l’échec sous Windows ne dépend plus de deux sondages d’interpréteur distincts.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

tests/repo/python-adapter.test.ts ("selects the pytest files a change reaches and runs them with the interpreter it found") failed once on check (windows-latest, 24) for the docs-only PR #291 (run 44200296961, job 134452346206). The other three check jobs in that run passed:

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+     executable: 'python3'
-     executable: 'python'
    at TestContext.<anonymous> (D:\a\core\core\tests\repo\python-adapter.test.ts:111:14)

Why it can disagree. The test and the adapter each probe for an interpreter, in different directories and at different times:

  • The test computes the expected interpreter once at module load: const interpreter = pythonInterpreter(process.cwd()); (L70).
  • The adapter calls pythonInterpreter() again, with the fixture's temp directory as cwd, when it builds the graph.
  • pythonInterpreter() (src/repo/adapters/python.ts L74) tries python3, then python, then py -3, each with a 10 s spawnSync timeout, and takes the first that prints 3.

On Windows runners, python3 is often the App Execution Alias stub or a slow first start. One probe can fail or time out on python3 and fall through to python, while the next probe succeeds with python3. The command the adapter writes is valid either way, but the assertion pins the test's own probe result.

This is not the known Rust temp-dir EBUSY/EPERM flake (#235); the failing test and the error are different. Recent Windows failures on other PRs were all the Rust one, so this looks rare.

Expected: the test asserts the interpreter the analysis recorded (or any working Python 3 launcher), not a second independent probe. Alternatively, pythonInterpreter() gives the same answer for the whole process, so one run cannot get two different interpreters.

Langage dominant
TypeScript
Étoiles
0
Forks
4
Merge moyen
18 h 41 min
PR mergées (30 j)
48

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de DiffCI/core

Toutes les issues de DiffCI/core

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.