From 1c6abe9b5909c2d0c1f7dc7ea61c9df54e145359 Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Tue, 21 Jul 2026 18:49:40 -0700 Subject: [PATCH] =?UTF-8?q?test(hooks):=20skipif=20non-Linux=20on=20the=20?= =?UTF-8?q?two=20real-/proc=20tests=20=E2=80=94=20Windows=20runner=20has?= =?UTF-8?q?=20no=20/proc,=20one=20asserted=20a=20value=20the=20platform=20?= =?UTF-8?q?by=20design=20returns=20None=20for=20(CI=20catch=20on=204169d08?= =?UTF-8?q?5,=20learning=20#275=20class:=20hermeticity=20on=20the=20Win=20?= =?UTF-8?q?runner)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/aipass/hooks/tests/test_cc_sessions.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/aipass/hooks/tests/test_cc_sessions.py b/src/aipass/hooks/tests/test_cc_sessions.py index 57691188..a71bff4e 100644 --- a/src/aipass/hooks/tests/test_cc_sessions.py +++ b/src/aipass/hooks/tests/test_cc_sessions.py @@ -2,8 +2,11 @@ import json import os +import sys from unittest.mock import patch +import pytest + from aipass.hooks.apps.modules import cc_sessions @@ -30,15 +33,15 @@ class TestIsPidAlive: class TestProcStartTicks: + @pytest.mark.skipif(sys.platform != "linux", reason="reads the real /proc filesystem") def test_current_process_returns_value_on_linux(self): - with patch("sys.platform", "linux"): - result = cc_sessions._proc_start_ticks(os.getpid()) + result = cc_sessions._proc_start_ticks(os.getpid()) assert result is not None assert result.isdigit() + @pytest.mark.skipif(sys.platform != "linux", reason="reads the real /proc filesystem") def test_matches_raw_proc_stat_field(self): - with patch("sys.platform", "linux"): - result = cc_sessions._proc_start_ticks(os.getpid()) + result = cc_sessions._proc_start_ticks(os.getpid()) from pathlib import Path raw = Path(f"/proc/{os.getpid()}/stat").read_text(encoding="utf-8")