test(cli): stop patching Path.stat with a 1-arg lambda in the FTS notice test

The salvaged #88217 test replaced Path.stat on the class with a lambda
taking one positional arg; pathlib.exists() passes follow_symlinks= and
pytest's own tmp_path teardown crashed with INTERNALERROR TypeError.
Delegate to the real stat for every path other than state.db.
This commit is contained in:
kshitijk4poor
2026-09-03 04:14:12 +05:30
committed by kshitij
parent 0de34c1f13
commit b94581315e
+11 -1
View File
@@ -34,7 +34,17 @@ def test_update_notice_offers_v1_trigram_tool_calls_rebuild(tmp_path, monkeypatc
monkeypatch.setattr(hermes_constants, "get_hermes_home", lambda: tmp_path)
monkeypatch.setattr(hermes_state, "SessionDB", FakeSessionDB)
monkeypatch.setattr(update_cmd.Path, "stat", lambda _path: SimpleNamespace(st_size=512 * 1024 ** 2))
# Report a large state.db without patching Path.stat globally: a
# 1-arg lambda on the class breaks pathlib.exists(follow_symlinks=...)
# for every caller in the process (pytest's own teardown included).
real_stat = update_cmd.Path.stat
def _stat(path, *args, **kwargs):
if path.name == "state.db":
return SimpleNamespace(st_size=512 * 1024 ** 2)
return real_stat(path, *args, **kwargs)
monkeypatch.setattr(update_cmd.Path, "stat", _stat)
update_cmd._print_fts_optimize_available_notice()