fix(tests): hidden-dirs suite must not die at collection on Windows - #102014
Closed
salch-cred wants to merge 1 commit into
Closed
salch-cred wants to merge 1 commit into
salch-cred wants to merge 1 commit into
Conversation
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.
Duplicate of #42872: it applies the same shutil.which import-safe gate and Windows skips for the POSIX-only find/grep tests. |
Author
|
Closing in favor of #42872, an earlier and still-open PR covering the same |
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.
Summary
The rg-gated tests in
tests/tools/test_search_hidden_dirs.pyevaluatedsubprocess.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 withERROR tests/tools/test_search_hidden_dirs.py - FileNotFoundError: [WinError 2]— instead of two tests skipping.Found during a full-repo
pytest --cocollection sweep on native Windows: 17 collection errors repo-wide, this file among them and NOT covered by #96458's 305-file set (verified).Fix
shutil.which("rg")resolved once at import — no subprocess, no crash, correct skip when ripgrep is absentfind/grepfallback classes whose shell command strings (find ... -not -path '*/.*') only exist on UnixWindows 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 WindowsnSelf-contained test-infrastructure fix; no production code touched. Complements #96458's full-suite Windows-CI direction.