Files
isparkclaw-webui/tests/test_model_resolver.py
nesquena-hermes c3807482be fix(tests): pin _cfg_mtime=0.0 in except so CI reload_config() guard works
Root cause of persistent CI failure on `test_custom_endpoint_uses_model_config_api_key_for_model_discovery`:

The helper `_available_models_with_full_cfg` and the failing test itself both do:
```python
try:
    _cfg._cfg_mtime = stat().st_mtime
except Exception:
    pass  # ← leaves _cfg_mtime at stale value from a prior test
```

On CI (no `~/.hermes/config.yaml`), `stat()` raises `OSError`. `get_available_models()` then sees `_current_mtime=0.0 != _cfg_mtime=<stale from prior test>`, calls `reload_config()`, overwrites the test's in-memory `cfg`, `api_key` disappears, `urlopen` is never called, `captured['auth']` raises `KeyError`.

**Fix:** The `except` clause now sets `_cfg._cfg_mtime = 0.0` (matching what `get_available_models()` will see when `stat()` also fails), so the reload guard becomes a no-op and the test's `cfg` mutation survives. Same pattern already used correctly in `test_custom_provider_display_name.py` and `test_ttl_cache.py`.

Verified with `HERMES_CONFIG_PATH=/tmp/nonexistent` to reproduce the CI no-config condition locally. 1747/1747 full suite.
2026-04-21 17:49:10 -07:00

20 KiB