hermes - 💡(How to fix) Fix test: bare `import grp` in TestSystemServiceIdentityRootHandling lacks platform guard [3 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

grp imported lazily inside test bodies with no pytest.importorskip guard, unlike pwd which is already guarded at module level.

Fix Action

Fixed

Code Example

pwd = pytest.importorskip("pwd")
grp = pytest.importorskip("grp")
RAW_BUFFERClick to expand / collapse

Problem

Three test methods in tests/hermes_cli/test_gateway_service.py use inline import grp without a platform guard:

  • TestSystemServiceIdentityRootHandling.test_auto_detected_root_is_rejected (line 1342)
  • TestSystemServiceIdentityRootHandling.test_explicit_root_is_allowed (line 1353)
  • TestSystemServiceIdentityRootHandling.test_non_root_user_passes_through (line 1364)

The grp module is UNIX-only (not available on Windows). While the module already has pwd = pytest.importorskip("pwd") at line 10 which effectively skips the entire module on Windows, the inline import grp statements are inconsistent with the established pattern and will cause ModuleNotFoundError if the module-level guard is ever removed or the tests are isolated.

Root cause

grp imported lazily inside test bodies with no pytest.importorskip guard, unlike pwd which is already guarded at module level.

Expected behavior

grp should be guarded at module level alongside pwd, consistent with the pattern already in use:

pwd = pytest.importorskip("pwd")
grp = pytest.importorskip("grp")

This makes the skip intent explicit, removes redundant inline imports, and is defensive against future refactors.

Environment

  • File: tests/hermes_cli/test_gateway_service.py
  • Lines: 1342, 1353, 1364
  • Platform affected: Windows (and any non-POSIX system without grp)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

grp should be guarded at module level alongside pwd, consistent with the pattern already in use:

pwd = pytest.importorskip("pwd")
grp = pytest.importorskip("grp")

This makes the skip intent explicit, removes redundant inline imports, and is defensive against future refactors.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING