Python: a test inside a package misses imports that resolve from its basedir
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
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python, typescript
Línea de trabajo
Empieza en src/repo/adapters/python.ts, en resolvePythonGraph y la lógica de fileRoots por archivo. Lee las pruebas existentes del grafo de Python y añade un caso que coincida con la estructura del paquete services/api/tests del issue, donde test_app.py importa app del mismo directorio. Se considera terminado cuando cambiar services/api/app.py selecciona esa prueba y el análisis de extremo a extremo la informa como afectada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
resolvePythonGraph (src/repo/adapters/python.ts, the fileRoots line in the per-file loop) adds a file's own directory to the import roots only when that directory has no __init__.py. pytest's default prepend import mode puts the file's basedir on sys.path: the first directory above the file's package. A test inside a package below the repository root can import modules beside that package, and DiffCI misses the edge.
pyproject.toml [tool.pytest.ini_options]
services/api/app.py def f(): return 1
services/api/tests/__init__.py
services/api/tests/test_app.py import app
python -m pytest services/api/tests/test_app.py passes (pytest 9.2).
Expected: a change to services/api/app.py selects services/api/tests/test_app.py.
Actual: no edge and no blocker (app is not first-party when seen from the root), so the change is selective with no tests:
resolvePythonGraph(
["services/api/app.py", "services/api/tests/__init__.py", "services/api/tests/test_app.py"],
{ "services/api/app.py": { imports: [] }, "services/api/tests/__init__.py": { imports: [] },
"services/api/tests/test_app.py": { imports: [["app", 0, []]] } },
{ pythonFiles: ["test_*.py"], testpaths: [], pythonpath: [] },
new Set(["services/api/tests/test_app.py"]),
); // { edges: [], blockers: [] }
End to end, ImpactAnalyzer returns fallbackRequired: false and no affected tests.
Fix: resolve against the basedir: the file's directory when it is not a package, otherwise the nearest ancestor without __init__.py.
- Lenguaje dominante
- TypeScript
- Estrellas
- 0
- Forks
- 4
- Merge medio
- 18 h 41 min
- PR fusionados (30 d)
- 48
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DiffCI/core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Planner: splitParts regex is quadratic on a quote followed by many backticks, so the fuzz test fails at randomPosiblemente ocupada @FredApps la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Agent tools: changed_files lists only the new path of a renamed filePosiblemente ocupada @FredApps la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
adapter good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
adapter bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
Todos los issues de DiffCI/core
Issues similares
-
agent-ready area: ui-server priority: p3 type: test
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
schlessera/brain-kit#4249 ·
Los mantenedores suelen responder en 1 día
-
documentation tool triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
can1357/oh-my-pi#19608 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
dependencies tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
bcgov/nr-waste-plus#1549 ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
blixvip/solana-tx-parse#18 ·