tests: add Windows skip guards for UNIX-only stdlib imports

This commit is contained in:
Wali Reheman 2026-05-09 06:29:55 -07:00 committed by Teknium
parent b6ff96c057
commit 4e8b8573ca
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
"""Tests for gateway service management helpers."""
import os
import pwd
pwd = pytest.importorskip("pwd")
import subprocess
from pathlib import Path
from types import SimpleNamespace
@ -1284,7 +1284,7 @@ class TestSystemServiceIdentityRootHandling:
def test_auto_detected_root_is_rejected(self, monkeypatch):
"""When root is auto-detected (not explicitly requested), raise."""
import pwd
pwd = pytest.importorskip("pwd")
import grp
monkeypatch.delenv("SUDO_USER", raising=False)
@ -1297,7 +1297,7 @@ class TestSystemServiceIdentityRootHandling:
def test_explicit_root_is_allowed(self, monkeypatch):
"""When root is explicitly passed via --run-as-user root, allow it."""
import pwd
pwd = pytest.importorskip("pwd")
import grp
root_info = pwd.getpwnam("root")
@ -1309,7 +1309,7 @@ class TestSystemServiceIdentityRootHandling:
def test_non_root_user_passes_through(self, monkeypatch):
"""Normal non-root user works as before."""
import pwd
pwd = pytest.importorskip("pwd")
import grp
monkeypatch.delenv("SUDO_USER", raising=False)

View file

@ -1,6 +1,6 @@
"""Tests for FileSyncManager.sync_back() — pull remote changes to host."""
import fcntl
fcntl = pytest.importorskip("fcntl")
import io
import logging
import os