From ff2922a9488389bdc713d5ab246d832e9181d76c Mon Sep 17 00:00:00 2001 From: Qian Zhang Date: Wed, 10 Jun 2026 20:13:11 -0400 Subject: [PATCH] test: fix the Python 3.10 Tests CI (surge namespace-shadow test) test_namespace_shadow_not_false_positive asserted surge reports "missing" (red), but on Python 3.10/3.11 _dep_status short-circuits to the "needs Python 3.12-3.14" gate (yellow) before reaching the namespace-shadow probe, so the test failed on the py3.10 matrix leg. Bypass the gate via monkeypatch so the probe path is exercised on every Python version; the generic probe_installed namespace logic stays covered by test_runner.py. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_doctor.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_doctor.py b/tests/test_doctor.py index 7906c23..211d0dd 100644 --- a/tests/test_doctor.py +++ b/tests/test_doctor.py @@ -57,10 +57,14 @@ def test_path_status_missing_and_configured(isolated_config): assert style == "green" -def test_namespace_shadow_not_false_positive(): - # surge-py is NOT installed in the core test venv. The repo's lowercase - # surge/ directory must not be mistaken for the installed library (PEP 420 - # namespace shadow), so the dependency must report missing, not ok. +def test_namespace_shadow_not_false_positive(monkeypatch): + # surge-py is NOT installed in the test venv. The repo's lowercase surge/ + # directory must not be mistaken for the installed library (PEP 420 namespace + # shadow), so the dependency must report missing, not ok. Bypass surge's + # Python-version gate (it is 3.12-3.14 only) so this exercises the probe path + # on every Python version — otherwise on 3.10/3.11 _dep_status short-circuits + # to the "needs Python 3.12-3.14" warning before reaching the probe. + monkeypatch.setattr(doctor, "_surge_supported", lambda: True) style, msg = doctor._dep_status(get_tool("surge")) assert style == "red", f"expected surge missing, got {style}: {msg}"