tests: cover partial Windows known-folder results (TEST-WINDOWS-KNOWN-FOLDERS) #835
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/835"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-24T14:22:07Z.
Claimed in the coordination issue as: TEST-WINDOWS-KNOWN-FOLDERS
What and why
known_folders()can return partial results. The live test expected all three paths and failed when the restricted Windows shell returned two. Allow the documented result count, retain the live absolute-path and repeat-call checks, and add a mock shell test that verifies partial results and buffer cleanup.This test-only change carries forward my earlier
ProjectLeonida/LeonidaPR #10060, rechecked against this repository'smain.Tested
After a rebase on
main56bdd7e8(56d42dab, same patch as528dc900), on Windows 11, Python 3.12.4:tests/test_make_game_preflight.py110 run, OK (1 skipped), also from a venv whose path has a space;tests/test_make_game_pipeline_preflight.py23 run, OK (1 skipped);test_tool_stdout_encoding.py,test_docs_cli_flags.py,test_text_write_line_endings.py,test_ctest_registration.pyandtest_ci_registration.pyOK;git diff --checkand the no-game-data check clean.GameDiscoveryTest.test_known_folders_from_the_shellfailed onmainatd0da7dadwith2 != 3in the restricted session.python -I -B tests/test_make_game_preflight.pyon this branch: 98 passed and 1 skipped in both the restricted and normal Windows sessions. The skipped test requires a case-sensitive filesystem.python -I -B tests/test_make_game_pipeline_preflight.py: 19 passed and 1 skipped. The skipped test requires POSIX execute permissions.git diff --checkandpython -I -B scripts/check_no_game_data.py tests/test_make_game_preflight.py: passed.GPUs tested: n/a. CPU-only tests.
AI-assisted: Yes, Codex.
Checklist
main.Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:25:46Z.
Review: APPROVED
Clean-Room Peer Review for PR #835 (tests: cover partial Windows known-folder results)
Robust test hardening for Windows enterprise/redirected profile environments:
LGTM! Verified and approved.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:28:12Z.
Review: APPROVED
Clean-room verified (zero game data). Comprehensive test coverage for partial Windows SHGetKnownFolderPath results ensuring CoTaskMemFree is called and successful paths are retained in make_game.known_folders().
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-24T21:22:15Z.
Rebased on
main6293c1c4:6d329f1d->528dc900, same patch (git range-diff). The previous base failedtests/test_tool_stdout_encoding.py, which #948 fixed onmain, and the earlier CI run never started (action_required).tests/test_make_game_preflight.py99 run, OK (1 skipped);test_tool_stdout_encoding.py,test_docs_cli_flags.pyandtest_text_write_line_endings.pyOK;git diff --checkand the no-game-data check clean.6d329f1d.No code change in this rebase. CI on the new head is still queued.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:23:51Z.
Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main
b0f3d3998(merge commit 151e2066e).python -I tests/test_make_game_preflight.py:test_tool_available_command_with_arguments(AssertionError: False is not true). It fails because this venv's path has a space, which #482 fixes. It is not related to this PR.(AI-assisted test run; output checked by hand.)
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-26T16:19:10Z.
Thanks for the run. The failing test,
test_tool_available_command_with_arguments, comes from the venv path with a space, as you said, and #482 fixed it onmain(merged after your run,7b523287).Windows 11, Python 3.12.4, with a venv in a folder whose name has a space,
python -I -B tests/test_make_game_preflight.py:mainb0f3d399(your base): 99 run, the same failure;main24679161: 110 run,OK (skipped=1).The merge with
mainis clean and the head (528dc900) is unchanged.AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-26T16:22:42Z.
Rebased from
528dc900to56d42dabonmain56bdd7e8, same patch (git range-diff), so the branch now includes #482.Windows 11, Python 3.12.4, on the new head:
tests/test_make_game_preflight.py: 110 run,OK (skipped=1), both from the usual interpreter and from a venv whose path has a space (the case from the run above).tests/test_make_game_pipeline_preflight.py: 23 run,OK (skipped=1).test_tool_stdout_encoding.py4,test_docs_cli_flags.py4,test_text_write_line_endings.py3,test_ctest_registration.py6 andtest_ci_registration.py16: OK.git diff --check, the no-game-data check andcompileall: clean.No code change in this rebase. The description's Tested section is updated.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T19:42:36Z.
Merge test and review, taken from the pool PRs MoonEyes had not checked yet. Main
ec91d695cmerged without conflict; the PR's test files run with the pins oftests/requirements.txton Windows 11, Python 3.12 (venv). AI-assisted (Claude Code, Claude Opus 5.5).assertEqual→assertLessEqualweakens the real-Windows check (an empty result now passes). Whether thentmock works on Linux was not run (ASSUMED).Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T00:27:10Z.
Verified by OreoFR
48bae6cad+ PR head56d42dabe(mergegit merge --no-ff, clean)python -I tests/test_make_game_preflight.pytest_known_folders_keeps_available_paths_when_a_lookup_failspasses (test-only PR, it covers behaviour main already has)test_ensure_submodule_names_the_clone_command_the_readme_gives, which fails the same way on clean main (109 tests), so not from this PRassertEqualtoassertLessEqual)AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:40:18Z.
Independent verification on Windows 11 (
10.0.26200, x64) of56d42dabe8merged ontoorigin/main(0efc2bd43d,0merge conflicts), tested under bothPython 3.12.10andPython 3.14.5:tests/test_make_game_preflight.py):python -I -B tests/test_make_game_preflight.py:109/110passed (skipped=2) on bothPython 3.12.10(3.18 s) andPython 3.14.5(4.55 s). Bothtest_known_folders_from_the_shellandtest_known_folders_keeps_available_paths_when_a_lookup_failspass cleanly; the single failure (test_ensure_submodule_names_the_clone_command_the_readme_gives) matchesorigin/mainalone (108/109,failures=1, skipped=2).mock.patch.object(ctypes, "WinDLL", ..., create=True)allows the mock known-folder test to patchWinDLLcleanly even on platforms wherectypes.WinDLLis absent.git diff --check,python -I -m compileall -q tests/test_make_game_preflight.py,python -I scripts/check_no_game_data.py tests/test_make_game_preflight.py,python -I tests/test_ci_registration.py(18/18), andpython -I tests/test_text_write_line_endings.py(3/3) all exited0.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T01:52:45Z.
@OreoFR's note was right: with
assertLessEqualthe real-Windows check also passed for an empty or shortened result.257191b8bmakes it an equality again without depending on which folders a machine has:KF_FLAG_DONT_VERIFY,SHGetKnownFolderPathreports a known folder only where it exists. So the expected result is each folder's unverified path (the same call withKF_FLAG_DONT_VERIFY,0x4000) that is a directory, inKNOWN_FOLDERSorder, andtest_known_folders_from_the_shellnow assertsknown_folders()equals that list.known_folders()that drops a folder that exists now fails.Tested on Windows 11, Python 3.12.4, on the PR head:
python -I tests/test_make_game_preflight.py: 110 tests, OK (skipped=1).python -I tests/test_make_game_preflight.py -k known_folders: 4 tests, OK. On this machine Downloads and Documents are redirected to another drive, and the unverified paths andknown_folders()agree.known_folders()replaced by one returning[], or one dropping the first folder,test_known_folders_from_the_shellfails (1 failure each); both passed with the previousassertLessEqual.scripts/check_no_game_data.py,compileall,git diff --checkandtests/test_text_write_line_endings.py: clean.AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:37:13Z.
#835 | head
257191b8bb(merged cleanly onto origin/mainc8bf0e7b65) | Windows 11 (10.0.26200.9974), Python 3.12.10 (x64) | AI-assisted: yesSummary — PASS (Re-verification of updated head
257191b8bb37)Re-verified updated head
257191b8bb375bb3f8ba15b8edd91800642f8f92(replacing56d42dabe8'sassertLessEqualupper bound with an exactKF_FLAG_DONT_VERIFYshell comparison) merged cleanly ontoorigin/main(c8bf0e7b6568f471b42540010e335ca6413d4c58,git merge-tree --write-treeexit0).Red -> Green Verification on Native Windows 11 (
os.name == "nt")origin/mainc8bf0e7b65):GameDiscoveryTest.test_known_folders_keeps_available_paths_when_a_lookup_failsis absent (rc=1), andtest_known_folders_from_the_shellrequireslen(folders) == len(make_game.KNOWN_FOLDERS)(3), failing on Windows hosts where any ofDesktop,Downloads, orDocumentsis unprovisioned on disk.origin/main+#835):python -m unittest tests.test_make_game_preflight.GameDiscoveryTest -v->12/12passed (0.061s,OK):test_known_folders_from_the_shell: queries liveshell32.SHGetKnownFolderPathboth viamake_game.known_folders()(flags=0) andunverified_known_folders()(KF_FLAG_DONT_VERIFY = 0x4000), confirming exact equality with[p for p in unverified_known_folders() if os.path.isdir(p)](3/3existing absolute known folders on this host, repeatable across calls withole32.CoTaskMemFreecleanup).test_known_folders_keeps_available_paths_when_a_lookup_fails: confirms partial success when the middleSHGetKnownFolderPathlookup fails (rc=-1,path=None), preserving both successful paths in order and passing[addr0, None, addr2]toCoTaskMemFree.tests.test_make_game_preflightsuite:109 -> 110tests (+1new test passing; the single failure in the full file is the pre-existingREADME.mdclone-URL check already failing identically on unpatchedorigin/mainc8bf0e7b65).Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:27:14Z.
Merged. Tested by zmasi on this head (Windows 11, Python 3.12.10): the new known-folders test is absent on main and passes with the PR (PASS). AI-assisted: yes.