Skip to content

fix(tests): use shutil.which instead of Unix 'which', skip Unix 'find' tests on Windows - #90267

Open
iamiskender wants to merge 1 commit into
NousResearch:mainfrom
iamiskender:main
Open

fix(tests): use shutil.which instead of Unix 'which', skip Unix 'find' tests on Windows#90267
iamiskender wants to merge 1 commit into
NousResearch:mainfrom
iamiskender:main

Conversation

@iamiskender

Copy link
Copy Markdown

What

tests/tools/test_search_hidden_dirs.py collection crashed on native Windows with FileNotFoundError: [WinError 2] — the TestRipgrepAlreadyExcludesHidden skipif condition called subprocess.run(["which", "rg"], ...), and which doesn't exist on Windows.

TestFindExcludesHiddenDirs also relies on the Unix find command via shell=True, which resolves to Windows' incompatible FIND.EXE and fails.

Fix

  • Replaced the which-based ripgrep detection with shutil.which("rg"), which works cross-platform.
  • Marked TestFindExcludesHiddenDirs with @pytest.mark.skipif(sys.platform == "win32", ...) since the find-based assertions are Unix-specific.

Testing

pytest tests/tools/test_search_hidden_dirs.py -v on native Windows — 8 passed, 2 skipped (previously: collection error, 0 tests ran).

@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage duplicate This issue or pull request already exists sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Aug 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #42872: both replace the Unix which probe and skip the Unix-only find tests on Windows. #42872 additionally covers the adjacent grep-only test class.

@iamiskender

Copy link
Copy Markdown
Author

Ack, thanks — closing as duplicate of #42872.

@iamiskender

Copy link
Copy Markdown
Author

Ack, thanks — closing as duplicate of #42872.

@iamiskender iamiskender reopened this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants