hermes - 💡(How to fix) Fix tests: add Windows skip guards for UNIX-only stdlib imports (pwd, fcntl) on v2026.5.7

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…

Two test modules in v2026.5.7 import UNIX-only stdlib at module top with no Windows guard, hard-blocking pytest collection on sys.platform == "win32":

pwd and fcntl exist only in CPython on UNIX-family platforms (cpython/Lib/pwd.py, cpython/Lib/fcntl.py). Importing either at module top on Windows raises ModuleNotFoundError during pytest collection, which hard-stops the test run before any test executes.

Error Message

On Windows with hermes-agent v2026.5.7 + [dev,acp] installed

python -m pytest tests/hermes_cli/test_gateway_service.py -q

ImportError while importing test module 'tests/hermes_cli/test_gateway_service.py'

tests\hermes_cli\test_gateway_service.py:4: in <module>

import pwd

E ModuleNotFoundError: No module named 'pwd'

Root Cause

Hermes Agent now ships an in-product staged-update endpoint (POST /api/agents/update/staged) whose pytest gate hard-fails on the first collection error and auto-rolls back. On Windows, both test files prevent the staged update from ever reaching verified=true, even though the runtime itself runs fine on Windows.

Fix Action

Fix / Workaround

Option 1 — pytest.importorskip (smallest patch, most idiomatic):

# tests/hermes_cli/test_gateway_service.py
import pytest
pwd = pytest.importorskip("pwd")        # skip cleanly on Windows

`v2026.5.7` also shipped with the 50 stale tests later removed in [`66320de52`](https://github.com/NousResearch/Hermes-Agent/commit/66320de52e9d77c5afc9767a350447011c8577f1) ("test: remove 50 stale/broken tests to unblock CI (#22098)"). That cleanup is on `main` but no patch release tag (`v2026.5.8`+) yet includes it. Downstream consumers running the full pytest gate against the `v2026.5.7` tag — Windows skip-guards or not — will still hit those 50 known-stale failures. A `v2026.5.8` patch tag that includes `66320de52` would let staged consumers verify cleanly.

Code Example

# On Windows with hermes-agent v2026.5.7 + [dev,acp] installed
python -m pytest tests/hermes_cli/test_gateway_service.py -q
# ImportError while importing test module 'tests/hermes_cli/test_gateway_service.py'
# tests\hermes_cli\test_gateway_service.py:4: in <module>
#     import pwd
# E   ModuleNotFoundError: No module named 'pwd'

---

# tests/hermes_cli/test_gateway_service.py
import pytest
pwd = pytest.importorskip("pwd")        # skip cleanly on Windows

# tests/tools/test_file_sync_back.py
import pytest
fcntl = pytest.importorskip("fcntl")    # skip cleanly on Windows

---

import sys
import pytest
pytestmark = pytest.mark.skipif(sys.platform == "win32",
    reason="Tests for UNIX-only systemd/file-locking surface")
import pwd  # / import fcntl
RAW_BUFFERClick to expand / collapse

Summary

Two test modules in v2026.5.7 import UNIX-only stdlib at module top with no Windows guard, hard-blocking pytest collection on sys.platform == "win32":

pwd and fcntl exist only in CPython on UNIX-family platforms (cpython/Lib/pwd.py, cpython/Lib/fcntl.py). Importing either at module top on Windows raises ModuleNotFoundError during pytest collection, which hard-stops the test run before any test executes.

Reproduction

# On Windows with hermes-agent v2026.5.7 + [dev,acp] installed
python -m pytest tests/hermes_cli/test_gateway_service.py -q
# ImportError while importing test module 'tests/hermes_cli/test_gateway_service.py'
# tests\hermes_cli\test_gateway_service.py:4: in <module>
#     import pwd
# E   ModuleNotFoundError: No module named 'pwd'

Same failure pattern on test_file_sync_back.py for fcntl.

Why this matters

Hermes Agent now ships an in-product staged-update endpoint (POST /api/agents/update/staged) whose pytest gate hard-fails on the first collection error and auto-rolls back. On Windows, both test files prevent the staged update from ever reaching verified=true, even though the runtime itself runs fine on Windows.

Proposed fix

Two clean options, in order of preference:

Option 1 — pytest.importorskip (smallest patch, most idiomatic):

# tests/hermes_cli/test_gateway_service.py
import pytest
pwd = pytest.importorskip("pwd")        # skip cleanly on Windows

# tests/tools/test_file_sync_back.py
import pytest
fcntl = pytest.importorskip("fcntl")    # skip cleanly on Windows

Option 2 — module-level skipif:

import sys
import pytest
pytestmark = pytest.mark.skipif(sys.platform == "win32",
    reason="Tests for UNIX-only systemd/file-locking surface")
import pwd  # / import fcntl

importorskip is preferred because it self-documents the platform requirement at the import site and works for any platform that lacks the module (e.g. some embedded distributions).

Adjacent observation (drive-by; happy to file separately if preferred)

v2026.5.7 also shipped with the 50 stale tests later removed in 66320de52 ("test: remove 50 stale/broken tests to unblock CI (#22098)"). That cleanup is on main but no patch release tag (v2026.5.8+) yet includes it. Downstream consumers running the full pytest gate against the v2026.5.7 tag — Windows skip-guards or not — will still hit those 50 known-stale failures. A v2026.5.8 patch tag that includes 66320de52 would let staged consumers verify cleanly.

Context

Found while validating a downstream Hermes Agent integration's staged update path on both Windows (Python 3.14) and WSL2 Linux (Python 3.12.3). Lane A (Windows) hit the pwd import as the first hard blocker; lane B (Linux) got past it and reached the actual test suite. Happy to provide more reproduction detail if useful.

Filed under the user's authorization for "Option C — open upstream issue/PR for Windows skip guards" in a downstream coordination thread; not affiliated with NousResearch.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix tests: add Windows skip guards for UNIX-only stdlib imports (pwd, fcntl) on v2026.5.7