Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/tools/test_search_hidden_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
directories, matching ripgrep's default behavior.
"""

import shutil
import sys
import subprocess

import pytest
Expand Down Expand Up @@ -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 = (
Expand All @@ -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 = (
Expand All @@ -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):
Expand All @@ -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):
Expand Down