From 05e14b63392853d2dc633e1b20ce01d560d236f6 Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Sun, 5 Jul 2026 17:13:07 -0400 Subject: [PATCH] test(#5619): pin same-path model helper fixtures --- tests/test_issue1240_generic_cli_catalog_sync.py | 1 + tests/test_issue1881_phantom_custom_groups.py | 3 +++ tests/test_issue_neuralwatt_env_key.py | 3 +++ tests/test_provider_quota_status.py | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/tests/test_issue1240_generic_cli_catalog_sync.py b/tests/test_issue1240_generic_cli_catalog_sync.py index e98b4174..0ba635ef 100644 --- a/tests/test_issue1240_generic_cli_catalog_sync.py +++ b/tests/test_issue1240_generic_cli_catalog_sync.py @@ -96,6 +96,7 @@ def _configure(monkeypatch, tmp_path, *, provider: str, default: str = ""): }, ) monkeypatch.setattr(config, "_cfg_mtime", 0.0) + monkeypatch.setattr(config, "_cfg_path", config._get_config_path(), raising=False) config.invalidate_models_cache() diff --git a/tests/test_issue1881_phantom_custom_groups.py b/tests/test_issue1881_phantom_custom_groups.py index 05250715..6ed8df1b 100644 --- a/tests/test_issue1881_phantom_custom_groups.py +++ b/tests/test_issue1881_phantom_custom_groups.py @@ -59,6 +59,7 @@ def _with_ai_gateway_and_custom_provider(): gateway also exposes.""" old_cfg = dict(config.cfg) old_mtime = config._cfg_mtime + old_path = getattr(config, "_cfg_path", None) config.cfg.clear() config.cfg.update( { @@ -81,11 +82,13 @@ def _with_ai_gateway_and_custom_provider(): config._cfg_mtime = config.Path(config._get_config_path()).stat().st_mtime except Exception: config._cfg_mtime = 0.0 + config._cfg_path = config._get_config_path() def restore(): config.cfg.clear() config.cfg.update(old_cfg) config._cfg_mtime = old_mtime + config._cfg_path = old_path config.invalidate_models_cache() return restore diff --git a/tests/test_issue_neuralwatt_env_key.py b/tests/test_issue_neuralwatt_env_key.py index b1b4ced2..13d4457f 100644 --- a/tests/test_issue_neuralwatt_env_key.py +++ b/tests/test_issue_neuralwatt_env_key.py @@ -27,12 +27,14 @@ def _force_env_fallback(monkeypatch): def _run_available_models_with_cfg(monkeypatch, tmp_path, cfg): old_cfg = dict(config.cfg) old_mtime = config._cfg_mtime + old_path = getattr(config, "_cfg_path", None) monkeypatch.setattr(config, "_models_cache_path", tmp_path / "models_cache.json") monkeypatch.setattr(config, "_get_config_path", lambda: tmp_path / "missing-config.yaml") monkeypatch.setattr("api.profiles.get_active_hermes_home", lambda: tmp_path, raising=False) config.cfg.clear() config.cfg.update(cfg) config._cfg_mtime = 0.0 + config._cfg_path = config._get_config_path() config.invalidate_models_cache() try: return config.get_available_models() @@ -40,6 +42,7 @@ def _run_available_models_with_cfg(monkeypatch, tmp_path, cfg): config.cfg.clear() config.cfg.update(old_cfg) config._cfg_mtime = old_mtime + config._cfg_path = old_path config.invalidate_models_cache() diff --git a/tests/test_provider_quota_status.py b/tests/test_provider_quota_status.py index c8a4fb11..5da86818 100644 --- a/tests/test_provider_quota_status.py +++ b/tests/test_provider_quota_status.py @@ -39,6 +39,7 @@ class _FakeResponse: def _with_config(model=None, providers=None): old_cfg = dict(config.cfg) old_mtime = config._cfg_mtime + old_path = getattr(config, "_cfg_path", None) config.cfg.clear() config.cfg["model"] = model or {} if providers is not None: @@ -47,6 +48,8 @@ def _with_config(model=None, providers=None): config._cfg_mtime = config.Path(config._get_config_path()).stat().st_mtime except Exception: config._cfg_mtime = 0.0 + config._cfg_path = config._get_config_path() + _restore_config._old_path = old_path return old_cfg, old_mtime @@ -54,6 +57,7 @@ def _restore_config(old_cfg, old_mtime): config.cfg.clear() config.cfg.update(old_cfg) config._cfg_mtime = old_mtime + config._cfg_path = getattr(_restore_config, "_old_path", None) def test_openrouter_quota_fetches_key_endpoint_and_sanitizes_response(monkeypatch, tmp_path):