From a0b7679edfcdeae5be53bc07ffbcb1e90128d54f Mon Sep 17 00:00:00 2001 From: xiaodu55 <1704788159@qq.com> Date: Sun, 4 Oct 2026 10:22:20 +0800 Subject: [PATCH] test(channels): skip the POSIX-bound mode assertions on Windows hosts (#6257) The channel runtime config store's atomic 0o600-temp + replace + chmod cannot land a POSIX mode on Windows, where chmod is a no-op approximation. Skip the two POSIX-bound tests and guard the trailing mode assertion of the chmod-failure test, keeping its platform- independent log-behavior coverage everywhere. Fixes #6256 Co-authored-by: xiaodu55 --- .../blocking_io/test_channel_runtime_config_store.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/tests/blocking_io/test_channel_runtime_config_store.py b/backend/tests/blocking_io/test_channel_runtime_config_store.py index b649893af8..8f86e68e09 100644 --- a/backend/tests/blocking_io/test_channel_runtime_config_store.py +++ b/backend/tests/blocking_io/test_channel_runtime_config_store.py @@ -18,6 +18,7 @@ from __future__ import annotations import asyncio import importlib import logging +import os from pathlib import Path from types import SimpleNamespace from unittest import mock @@ -107,6 +108,7 @@ async def test_disconnect_runtime_channel_does_not_block_event_loop(tmp_path) -> } +@pytest.mark.skipif(os.name == "nt", reason="chmod cannot express owner-only modes on Windows") async def test_runtime_config_store_file_is_owner_only(tmp_path) -> None: path = tmp_path / "channels" / "runtime-config.json" store = await asyncio.to_thread(ChannelRuntimeConfigStore, path) @@ -121,6 +123,7 @@ async def test_runtime_config_store_file_is_owner_only(tmp_path) -> None: assert mode == 0o600 +@pytest.mark.skipif(os.name == "nt", reason="chmod cannot express owner-only modes on Windows") async def test_runtime_config_store_overwrites_loose_existing_file(tmp_path) -> None: """A pre-existing world-readable file is tightened to 0o600 after a save. @@ -170,6 +173,7 @@ async def test_runtime_config_store_chmod_failure_is_logged_not_fatal(tmp_path, await asyncio.to_thread(_save_with_failing_temp_chmod) assert any("Unable to chmod temporary channel runtime config store" in record.getMessage() for record in caplog.records) - mode = await asyncio.to_thread(lambda: path.stat().st_mode & 0o777) - assert mode == 0o600 + if os.name != "nt": # chmod cannot express owner-only modes on Windows + mode = await asyncio.to_thread(lambda: path.stat().st_mode & 0o777) + assert mode == 0o600 assert await asyncio.to_thread(store.get_provider_config, "slack") == {"enabled": True, "bot_token": "xoxb-ui"}