[PR #368] [MERGED] tests: sgpr census folding-volume case survives Windows realpath case (TEST-WIN-SWEEP) #420

Closed
opened 2026-11-26 20:17:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/368
Author: @ItsMrDubey
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: win-realpath-case-census


📝 Commits (1)

  • 608a24a tests: the sgpr census folding-volume case keeps the name's case through realpath on Windows

📊 Changes

1 file changed (+7 additions, -3 deletions)

View changed files

📝 tests/test_user_sgpr_census.py (+7 -3)

📄 Description

Claimed in the coordination issue as: TEST-WIN-SWEEP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121328982)

What and why

python -m pytest tests/test_user_sgpr_census.py fails on Windows in test_json_report_refuses_to_overwrite_index[folding-volume-case]: Expected 'mock' to have been called once. Called 0 times. The case writes index.json and passes INDEX.JSON as --json to simulate a case-folding volume, patching _resolved_key and os.path.samefile so only the _same_resolved_name probe can catch the collision. On Windows os.path.realpath returns an existing file's name as it is stored, so INDEX.JSON resolves to ...\index.json, the two keys already match and the probe is never asked. The tool did refuse the overwrite (exit 2), only by the other route; the test was wrong, not the code.

The case now also patches realpath with os.path.abspath, as tests/test_wave64_graphics_scan.py and tests/test_psin_names.py already do for the same simulation, so the spelling reaches the probe on every OS.

Tested

Windows 11, Python 3.11.9 and 3.12.9:

  • py -3.12 -m pytest tests/test_user_sgpr_census.py: before 1 failed, 43 passed; after 44 passed. Same with Python 3.11.9.
  • python -I scripts/check_no_game_data.py tests/test_user_sgpr_census.py: clean.
  • Linux/macOS: realpath never changed the case there, and tmp_path gives both names one parent, so abspath yields the same pair as before.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. n/a: no translator rule

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/368 **Author:** [@ItsMrDubey](https://github.com/ItsMrDubey) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `win-realpath-case-census` --- ### 📝 Commits (1) - [`608a24a`](https://github.com/ubiquitarianism/leonida/commit/608a24a1cd7cdabb7ac4bf839a99272fa2496fb0) tests: the sgpr census folding-volume case keeps the name's case through realpath on Windows ### 📊 Changes **1 file changed** (+7 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_user_sgpr_census.py` (+7 -3) </details> ### 📄 Description Claimed in the coordination issue as: TEST-WIN-SWEEP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121328982) ### What and why `python -m pytest tests/test_user_sgpr_census.py` fails on Windows in `test_json_report_refuses_to_overwrite_index[folding-volume-case]`: `Expected 'mock' to have been called once. Called 0 times.` The case writes `index.json` and passes `INDEX.JSON` as `--json` to simulate a case-folding volume, patching `_resolved_key` and `os.path.samefile` so only the `_same_resolved_name` probe can catch the collision. On Windows `os.path.realpath` returns an existing file's name as it is stored, so `INDEX.JSON` resolves to `...\index.json`, the two keys already match and the probe is never asked. The tool did refuse the overwrite (exit 2), only by the other route; the test was wrong, not the code. The case now also patches `realpath` with `os.path.abspath`, as `tests/test_wave64_graphics_scan.py` and `tests/test_psin_names.py` already do for the same simulation, so the spelling reaches the probe on every OS. ### Tested Windows 11, Python 3.11.9 and 3.12.9: - `py -3.12 -m pytest tests/test_user_sgpr_census.py`: before 1 failed, 43 passed; after 44 passed. Same with Python 3.11.9. - `python -I scripts/check_no_game_data.py tests/test_user_sgpr_census.py`: clean. - Linux/macOS: `realpath` never changed the case there, and `tmp_path` gives both names one parent, so `abspath` yields the same pair as before. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. n/a: no translator rule --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:49 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#420
No description provided.