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

Abierto Apto para principiantes
#304 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github-actions, python, typescript
Área
ci-cd, testing-qa

Línea de trabajo

Empieza por tests/repo/python-adapter.test.ts, especialmente por la aserción del intérprete alrededor de la línea 111; después, lee src/repo/adapters/python.ts y la configuración del intérprete en la prueba alrededor de la línea 70. Ejecuta la prueba del adaptador de Python y comprueba que compara con el intérprete registrado durante el análisis o que, en su defecto, tolera distintos lanzadores de Python 3 según el directorio de trabajo. El objetivo se cumple cuando el error de Windows ya no depende de dos consultas de intérprete independientes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
0
Forks
4
Merge medio
18 h 41 min
PR fusionados (30 d)
48

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DiffCI/core

Todos los issues de DiffCI/core

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.