From 4a4b9bd2dc86b1c360e31e4e104b226f6f1b0521 Mon Sep 17 00:00:00 2001 From: Kewe63 Date: Wed, 13 May 2026 00:00:28 +0300 Subject: [PATCH] fix(test): add platform guard for grp import Tests in test_gateway_service.py imported grp inline without a platform guard, causing ImportError on systems where grp is unavailable (e.g. macOS, WSL without grp module). Added pytest.importorskip('grp') at module level alongside the existing pwd guard, and removed three redundant inline import grp statements. Fixes #24531 --- tests/hermes_cli/test_gateway_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hermes_cli/test_gateway_service.py b/tests/hermes_cli/test_gateway_service.py index c529fa59a..b1d979200 100644 --- a/tests/hermes_cli/test_gateway_service.py +++ b/tests/hermes_cli/test_gateway_service.py @@ -8,6 +8,7 @@ from types import SimpleNamespace import pytest pwd = pytest.importorskip("pwd") +grp = pytest.importorskip("grp") import hermes_cli.gateway as gateway_cli from gateway import status @@ -1331,7 +1332,6 @@ class TestSystemServiceIdentityRootHandling: def test_explicit_root_is_allowed(self, monkeypatch): """When root is explicitly passed via --run-as-user root, allow it.""" - import grp root_info = pwd.getpwnam("root") root_group = grp.getgrgid(root_info.pw_gid).gr_name