test(tools): fix Windows compat in test_search_hidden_dirs - #41135
Closed
Thorx373 wants to merge 1 commit into
Closed
test(tools): fix Windows compat in test_search_hidden_dirs#41135Thorx373 wants to merge 1 commit into
Thorx373 wants to merge 1 commit into
Conversation
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tests/tools/test_search_hidden_dirs.pyfails at collection on Windows withFileNotFoundError: [WinError 2], aborting the pytest run. Once that's resolved, two further tests fail on Windows because they shell out to Unix-onlyfind/grep.Root Cause
@pytest.mark.skipifdecorators ransubprocess.run(["which", "rg"], ...)at collection time.whichdoesn't exist on Windows (it useswhere), so the call raisedFileNotFoundErrorduring import, before any test ran.test_find_still_returns_visible_filesandtest_grep_still_finds_visible_contentinvoke Unixfind/grepdirectly. On Windows,find.exeis a different command (FIND: Parameter format not correct) andgrepisn't present.Fix
subprocess.run(["which", "rg"])checks with cross-platformshutil.which("rg") is None. The ripgrep tests now run and pass on Windows.find/greptestsskipif(sys.platform == "win32")— they depend on Unix coreutils with no Windows equivalent, so a platform skip is correct rather than a rewrite. Behavior on macOS/Linux/CI is unchanged.Testing
Before:
FileNotFoundErrorat collection (entire file errors).After: file collects; ripgrep tests pass, Unix-coreutils tests skip on Windows.
Tested on Windows 11, Python 3.11.9.