From db46f4e8d7c4b26a88a63f6b90f1f14781dc40c4 Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Tue, 22 Sep 2026 22:04:45 +0000 Subject: [PATCH] test(#7312): skip the agent-backed positive control when agent.skill_utils is a stub tests/test_issue4783_profile_skills_mtime_cache.py installs a bare types.ModuleType stub for agent.skill_utils via sys.modules.setdefault and never restores it. On CI (no hermes-agent checkout) that stub satisfies pytest.importorskip, so the positive control ran against an rglob walk with MagicMock frontmatter and failed 9 == 7 on shard 4 of 5, all Pythons. Require a file-backed module; the control still runs (and passes) against the real agent package. --- tests/test_issue7305_profiles_fallback.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_issue7305_profiles_fallback.py b/tests/test_issue7305_profiles_fallback.py index 3a3331e3..2d8ac215 100644 --- a/tests/test_issue7305_profiles_fallback.py +++ b/tests/test_issue7305_profiles_fallback.py @@ -181,7 +181,13 @@ def test_agent_backed_path_counts_these_shapes_accurately(tmp_path): - dropping that config disable flips it to enabled without changing the compatible total. """ - pytest.importorskip("agent.skill_utils") + skill_utils = pytest.importorskip("agent.skill_utils") + # Other test files install a bare ``types.ModuleType`` stub for + # ``agent.skill_utils`` in ``sys.modules`` (no ``__file__``, rglob walk, + # MagicMock frontmatter). This positive control is only meaningful against + # the real agent package, so a stub must skip it, not satisfy it. + if not getattr(skill_utils, "__file__", None): + pytest.skip("agent.skill_utils is a test stub, not the real agent package") from agent.skill_utils import iter_skill_index_files home = _write_profile(tmp_path)