Repository navigation
BUILD-2991: test_ci_registration: a folder inside another repository gets the directory walk - #8087
Pablo-Barros wants to merge 2 commits into
Conversation
…e directory walk For a folder that only sits inside another repository, `git ls-files` exits 0 and lists nothing. With a .git in the home folder every temporary folder is one, and test_the_scan_flags_an_unlisted_file_and_a_file_pytest_cannot_collect raised KeyError on main. The scan now walks whenever git lists nothing, with a test beside the one for a missing git. AI-assisted (ZCode).
devnull34
left a comment
There was a problem hiding this comment.
Verified via Tier 2 Free Cloud (Groq gpt-oss-120b) & local test execution: Checking result.returncode == 0 and result.stdout in tracked_under_tests() correctly falls back to os.walk() when git ls-files exits 0 with an empty listing (e.g. temporary directories located inside a parent git repo without a tracked tests/ folder). All 15 tests in test_ci_registration.py pass cleanly.
|
Reproduced the defect end to end, and then this fix, on Linux (CachyOS 7.3.5, CPython 3.14.9). No game files, no GPU. The failure needs a temp directory that sits inside some git repository — which is what a
So the empty-listing fallback is what the test in this PR claims, and the change is exactly as wide as the bug: The rebase note in the description is right: #7744, #4977, #4754, #4703 and #3879 all edit this file. AI-assisted. |
|
Tested 222d6c7 on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. tests/test_ci_registration.py 15/15 OK. Negative control: helper reverted to 'if returncode == 0' → new test fails (0 not >= 300); restored, green. AI-assisted. |
|
Windows check at AI-assisted verification. |
|
Additional inventory-helper check at Both empty |
|
Tested
AI-assisted (Claude Code). |
…y walk Comment on ItsNotRexed#8087 (memphis19888-glitch): with an empty listing always walking, a repository root with no tracked file under tests/ also listed the files git ignores there. tracked_under_tests() now asks `git rev-parse --show-prefix` and keeps git's answer at a top level, so ignored files stay out as on main; the walk is for a folder that is not the top level of the repository around it. AI-assisted (ZCode).
|
Thanks @memphis19888-glitch: no, including ignored files was not intended, and your check is right. Commit A second new test holds the root case: an empty listing at a top level stays empty, with a test file on disk in the folder. AI-assisted (ZCode). |
Claimed in the coordination issue as: BUILD-2991 (claimed as a new item in #8047 (comment))
Depends on: builds on none. It changes
tests/test_ci_registration.py, which the open #7744, #4977, #4754, #4703 and #3879 also change, so it will need a rebase onto whichever of them lands first.What and why
tracked_under_tests()asksgit ls-filesfor the tracked files undertests/, and falls back to walking the folder only when git is missing or exits with a non-zero code.For a folder that merely sits inside another repository, git exits 0 and lists nothing, because the folder is not that repository's top level. With a
.gitin the home folder, everyTemporaryDirectoryis such a folder. On a machine like that,test_the_scan_flags_an_unlisted_file_and_a_file_pytest_cannot_collectraisesKeyError: 'tests/left_out_test.py'onmaindde82f27e: the scan of the temporary folder found no file. In the comments, Poll2512 reproduces the same on Linux withTMPDIRinside a repository.Now, when the listing is empty,
tracked_under_tests()asksgit rev-parse --show-prefix: a folder below the top level of the repository around it gets the walk, and a top level keeps git's answer. At a repository root nothing changes: atests/folder with no tracked file lists nothing, as onmain, and a file that git ignores stays out.The first commit here walked on any empty listing, which listed ignored files at such a root. The second commit narrows it after the comment below.
Tested
No GPU is involved. Windows 11 build 26300, Python 3.12.10, Git for Windows,
maindde82f27eplus this change, on a machine whose home folder holds a.git.python -I tests/test_ci_registration.py: 16 tests OK, three runs. Onmain, on the same machine: 14 tests, 1 error (KeyError: 'tests/left_out_test.py').--show-prefixanswerscheckout/fixture/), the scan lists the repository's test files. Onmainthe same calls list nothing;tests/test_fixture.pyon disk: this change lists nothing, asmaindoes in the comment below; the first commit listed the file.python -I tests/test_runner_calls_all_tests.py, which imports this module: 3 tests OK.python -m compileall -q tests/test_ci_registration.pyandpython -I scripts/check_no_game_data.py tests/test_ci_registration.py: OK.AI-assisted: yes (ZCode)
Checklist
docs/design.md, with how it was confirmed. Not applicable: no translator rule changes.