fix(tests): stub _ensure_vercel_sdk in vercel sandbox tests — CI has no vercel dist

The tests fake the vercel SDK entirely via sys.modules, but
_ensure_vercel_sdk checks installed DISTRIBUTION metadata through
tools.lazy_deps.ensure(): on CI (no vercel dist + lazy installs
disabled) it raised FeatureUnavailable→ImportError before the fake SDK
was ever reached — 16 failures on slice 6, green on dev boxes that
happen to have vercel==0.7.2 installed. Failure mechanism reproduced
locally by forcing _is_satisfied False; fixture patch verified to close
it while the real-dist path stays green (16/16).
This commit is contained in:
Teknium 2026-07-29 21:18:35 -07:00
parent e7bf0ad8cd
commit 8eb06e75b9

View file

@ -221,7 +221,17 @@ def vercel_module(vercel_sdk, monkeypatch):
monkeypatch.setattr("tools.credential_files.iter_cache_files", lambda **kwargs: [])
module = importlib.import_module("tools.environments.vercel_sandbox")
return importlib.reload(module)
module = importlib.reload(module)
# These tests fully fake the vercel SDK via sys.modules (vercel_sdk
# fixture) — the real package is never exercised, so the lazy-install
# probe must not run: _ensure_vercel_sdk checks installed DISTRIBUTION
# metadata (not sys.modules), and on a host without the vercel dist +
# with lazy installs disabled (any hermetic env) it raises ImportError
# before the fake SDK is ever reached. 16 tests failed exactly this way
# in CI while passing on dev boxes that happened to have vercel==0.7.2
# installed.
monkeypatch.setattr(module, "_ensure_vercel_sdk", lambda: None)
return module
@pytest.fixture()