Skip to content

fix(tests): hidden-dirs suite must not die at collection on Windows - #102014

Closed
salch-cred wants to merge 1 commit into
NousResearch:mainfrom
salch-cred:fix/win-search-hidden-dirs-collection
Closed

salch-cred wants to merge 1 commit into
NousResearch:mainfrom
salch-cred:fix/win-search-hidden-dirs-collection

Conversation

@salch-cred

Copy link
Copy Markdown

Summary

The rg-gated tests in tests/tools/test_search_hidden_dirs.py evaluated subprocess.run(["which", "rg"]) inside the skipif decorator arguments at module import. On Windows there is no which executable, so that raises FileNotFoundError during collection and the whole 10-test module dies with ERROR tests/tools/test_search_hidden_dirs.py - FileNotFoundError: [WinError 2] — instead of two tests skipping.

Found during a full-repo pytest --co collection sweep on native Windows: 17 collection errors repo-wide, this file among them and NOT covered by #96458's 305-file set (verified).

Fix

  • gate the rg tests on shutil.which("rg") resolved once at import — no subprocess, no crash, correct skip when ripgrep is absent
  • POSIX-skip the find/grep fallback classes whose shell command strings (find ... -not -path '*/.*') only exist on Unix

Windows now collects all 10 tests: 2 cross-platform tests pass, 8 platform-skip. Linux CI unchanged — every test still runs there.

Verification

nbefore: ERROR at collection (10 tests lost) after: 2 passed, 8 skipped on Windows n
Self-contained test-infrastructure fix; no production code touched. Complements #96458's full-suite Windows-CI direction.

The rg-gated tests evaluated subprocess.run(["which", "rg"]) inside the
skipif decorator arguments at module import. On Windows there is no
which executable, so that raises FileNotFoundError during collection
and the whole 10-test module is lost instead of two tests skipping.

Gate the rg tests on shutil.which (resolved once at import, no
subprocess), and POSIX-skip the find/grep fallback tests whose shell
command strings only exist on Unix. Windows now collects 10 tests
(2 cross-platform pass, 8 platform-skips); Linux CI is unchanged —
every test still runs there.

Not covered by NousResearch#96458's 305-file set.
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows duplicate This issue or pull request already exists labels Sep 3, 2026
@alt-glitch

Copy link
Copy Markdown

This was generated by AI during triage.

Duplicate of #42872: it applies the same shutil.which import-safe gate and Windows skips for the POSIX-only find/grep tests.

@salch-cred

Copy link
Copy Markdown
Author

Closing in favor of #42872, an earlier and still-open PR covering the same shutil.which / POSIX-only-test-skip fix.

@salch-cred salch-cred closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets 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