Parity tests fail under the documented direct pytest invocation when the ambient python3 lacks PyYAML (11 failures)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
Línea de trabajo
Lee tests/parity_helpers.py y compara el comportamiento de clean_env() con el de _clean_env() en tests/test_check_prerequisites_python_parity.py. Empieza por comprobar cómo esas funciones auxiliares establecen PATH y cómo las pruebas del shim sin YAML conservan la precedencia. El trabajo estará terminado cuando la invocación directa de pytest use el intérprete de la suite para los subprocesos y pasen las pruebas de paridad afectadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Following AGENTS.md's prescribed invocation — uv sync --extra test then .venv/bin/python -m pytest — 11 parity tests fail on a fresh macOS checkout whose ambient python3 does not have PyYAML installed (e.g. Homebrew Python):
FAILED tests/test_check_prerequisites_python_parity.py::test_all_variants_resolve_requested_template[composed]
FAILED tests/test_check_prerequisites_python_parity.py::test_all_variants_validate_requested_template_in_text_mode[composed]
FAILED tests/test_create_new_feature_python_parity.py::test_all_variants_materialize_composed_spec_template
FAILED tests/test_resolve_template_python_parity.py (7 tests, all [composed]-style)
FAILED tests/test_setup_plan_python_parity.py::test_all_variants_materialize_composed_plan_template
FAILED tests/test_setup_tasks_python_parity.py::test_all_variants_return_composed_tasks_template
Each failure is the bash variant reporting Error: PyYAML is required to resolve preset template composition.
Root cause
run() in tests/parity_helpers.py defaults to clean_env(), which is a copy of os.environ — the script subprocesses resolve python3 -> python -> py -3 through the ambient PATH.
- In CI, tests run via
uv run pytest, anduv runprepends the project venv'sbin/to PATH, so the scripts find the venv interpreter (which has PyYAML) and everything passes. - Under the direct
.venv/bin/python -m pytestinvocation documented in AGENTS.md, PATH is untouched, so the scripts find the ambientpython3(no PyYAML) and fail.
tests/parity_helpers.py already contains make_python3_path_shim() whose docstring warns about exactly this hazard ("silently regains/loses that venv's site-packages (e.g. PyYAML)"), and tests/extensions/test_extension_agent_context.py contains a similar _ensure_test_python_on_path() helper — the composed-template tests just don't get the same treatment.
Suggested fix
Prepend the running interpreter's own bin directory to PATH inside parity_helpers.clean_env() — the same thing uv run does — so both invocations give the script subprocesses the same Python the suite runs on. Tests that install their own shim (the no_yaml_python3_shim cases) prepend afterwards and keep precedence, so the negative tests are unaffected. One tests/test_check_prerequisites_python_parity.py defines a file-local _clean_env() duplicate and needs the same treatment (delegate to the shared helper).
Reproduction
git clone https://github.com/github/spec-kit && cd spec-kit
uv sync --extra test # or: python -m venv .venv && pip install -e . pytest
# ensure the ambient `python3` has no PyYAML:
python3 -c "import yaml" || echo "ambient python3 has no PyYAML"
.venv/bin/python -m pytest tests/test_resolve_template_python_parity.py -q # 7 failed
PATH="$PWD/.venv/bin:$PATH" .venv/bin/python -m pytest tests/test_resolve_template_python_parity.py -q # all pass
Observed on macOS 15 (Apple Silicon), Python 3.12, spec-kit main at 08252af.
AI disclosure
Issue filed after diagnosis performed with AI assistance: OpenCode running GLM 5.3 Flash (Z.ai), agent mode under human supervision by @mehdikarimi55; environment reproduction, root-cause analysis, and verification of the PATH-based fix.
- Lenguaje dominante
- Python
- Estrellas
- 149k
- Forks
- 13.4k
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 223
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
- Tiene una 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 github/spec-kit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
triage-must-have
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Workflow-step verifier test fixture breaks when the checkout path contains whitespace (4 failures on macOS)Posiblemente ocupada @mehdikarimi55 la tomó hace 3 días. Abiertotriage-can-wait
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
bug triage-out-of-scope
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
triage-must-have
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
Todos los issues de github/spec-kit
Issues similares
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsPosiblemente ocupada @himanchalkaushale la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
OWASP/Nettacker#1884 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
A-connection-core C-enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
aws-samples/sample-per-model-bedrock#869 ·
Los mantenedores suelen responder en 1 día
-
Spec: say that included_antigen_sources gates LENS labels; do not merge it into antigen kindsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
fzn0x/watchtower#17 ·