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.
This commit is contained in:
nesquena-hermes committed 2026-09-22 22:04:45 +00:00
1 parent 6e94d1275e
commit db46f4e8d7
1 file changed
+7 -1
+7 -1
View File
@@ -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 - dropping that config disable flips it to enabled without changing the
compatible total. 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 from agent.skill_utils import iter_skill_index_files
home = _write_profile(tmp_path) home = _write_profile(tmp_path)