From de99dc564e23e41b68f0f57bb81fbffb123b550e Mon Sep 17 00:00:00 2001 From: Ganesh0690 Date: Sun, 7 Jun 2026 14:50:39 +0530 Subject: [PATCH] test(tools): fix Windows compat in test_search_hidden_dirs --- tests/tools/test_search_hidden_dirs.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_search_hidden_dirs.py b/tests/tools/test_search_hidden_dirs.py index 0c214c1583a4..5da14a3e5012 100644 --- a/tests/tools/test_search_hidden_dirs.py +++ b/tests/tools/test_search_hidden_dirs.py @@ -13,6 +13,8 @@ directories, matching ripgrep's default behavior. """ +import shutil +import sys import subprocess import pytest @@ -62,6 +64,10 @@ def test_find_skips_git_internals(self, searchable_tree): assert "pack-abc.idx" not in result.stdout assert ".git" not in result.stdout + @pytest.mark.skipif( + sys.platform == "win32", + reason="depends on Unix coreutils (find/grep) not available on Windows", + ) def test_find_still_returns_visible_files(self, searchable_tree): """find should still return files from visible directories.""" cmd = ( @@ -84,6 +90,10 @@ def test_grep_skips_hub_cache(self, searchable_tree): assert ".hub" not in result.stdout assert "catalog.json" not in result.stdout + @pytest.mark.skipif( + sys.platform == "win32", + reason="depends on Unix coreutils (find/grep) not available on Windows", + ) def test_grep_still_finds_visible_content(self, searchable_tree): """grep should still find content in visible directories.""" cmd = ( @@ -97,7 +107,7 @@ class TestRipgrepAlreadyExcludesHidden: """Verify ripgrep's default behavior is to skip hidden directories.""" @pytest.mark.skipif( - subprocess.run(["which", "rg"], capture_output=True).returncode != 0, + shutil.which("rg") is None, reason="ripgrep not installed", ) def test_rg_skips_hub_by_default(self, searchable_tree): @@ -110,7 +120,7 @@ def test_rg_skips_hub_by_default(self, searchable_tree): assert "catalog.json" not in result.stdout @pytest.mark.skipif( - subprocess.run(["which", "rg"], capture_output=True).returncode != 0, + shutil.which("rg") is None, reason="ripgrep not installed", ) def test_rg_finds_visible_content(self, searchable_tree):