mirror of
https://github.com/github/spec-kit.git
synced 2026-07-10 17:59:32 +08:00
test: pin interpreter probe so py-template render test passes on Windows (#3428)
test_template_renders_python_invocation monkeypatches shutil.which to return /usr/bin/python3, but on Windows resolve_python_interpreter guards the which() result with a real _interpreter_runs subprocess probe (#3304). The mocked /usr/bin/python3 path does not exist on a Windows runner, so the probe fails, the resolver falls back to sys.executable (a ...python.exe path), and the python3-anchored regex assertion fails. Patch _interpreter_runs to return True in the _pin_interpreter fixture so the resolved interpreter token stays python3 across all platforms, keeping the #3304 production guard intact while making the assertion deterministic. Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -39,6 +39,17 @@ def _pin_interpreter(monkeypatch):
|
||||
"specify_cli.integrations.base.shutil.which",
|
||||
lambda name: "/usr/bin/python3" if name == "python3" else None,
|
||||
)
|
||||
# On Windows, ``resolve_python_interpreter`` guards the ``which`` result
|
||||
# with a real ``_interpreter_runs`` subprocess probe (#3304). The mocked
|
||||
# ``/usr/bin/python3`` path does not exist on a Windows runner, so the
|
||||
# probe would fail and the resolver would fall back to ``sys.executable``
|
||||
# (a ``...python.exe`` path), breaking the ``python3``-anchored assertion.
|
||||
# Pin the probe to True so the interpreter token stays ``python3`` on all
|
||||
# platforms.
|
||||
monkeypatch.setattr(
|
||||
"specify_cli.integrations.base.IntegrationBase._interpreter_runs",
|
||||
staticmethod(lambda path: True),
|
||||
)
|
||||
|
||||
|
||||
def test_py_templates_discovered():
|
||||
|
||||
Reference in New Issue
Block a user