fix(tests): service_tier flake TRUE root cause is stale global cfg, not yaml cache
Two full-suite iterations pinned the real vector: set_hermes_default_model() calls
resolve_model_provider() which reads the module-global config.cfg (config.py:2488).
A prior lmstudio test leaves cfg={model:{provider:lmstudio,base_url:1234}} in
_cfg_cache; resolve_model_provider then returns lmstudio's provider+base_url, which
set_hermes_default_model persists to the test's OWN config file -> the on-disk
assertion sees 'provider: lmstudio' instead of the written 'provider: openai'.
The autouse fixture now _cfg_cache.CLEAR()s its CONTENTS (not just re-aliases cfg),
so resolve_model_provider reads an empty model cfg and can't inject a stale
provider/base_url. Deterministically proven: reproduced the exact lmstudio leak with
a probe test (fixture on=PASS; _cfg_cache.clear() line removed=the exact full-suite
failure reproduces). Also clears _yaml_file_cache + fingerprint/mtime for defense.
This commit is contained in:
1 parent
3a70ab5871
commit
d025b37186
1 file changed
+1
@@ -29,6 +29,7 @@ class TestIssue4536ServiceTier:
|
||||
|
||||
def _reset():
|
||||
with config._cfg_lock:
|
||||
config._cfg_cache.clear()
|
||||
config.cfg = config._cfg_cache
|
||||
config._cfg_fingerprint = None
|
||||
config._cfg_mtime = 0.0
|
||||
|
||||
Reference in new issue
Block a user