[PR #2175] test_mod_pack_output_alias: key the fake samefile on realpath, as report_paths does; passes on macOS (TEST-MOD-PACK-ALIAS-REALPATH) #2179

Open
opened 2026-11-26 21:20:19 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2175
Author: @Tauwni
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/mod-pack-alias-test-realpath


📝 Commits (2)

  • 904dfe2 test_mod_pack_output_alias: the fake samefile keys on realpath'd names, as report_paths does
  • 011fbd3 Merge main into fix/mod-pack-alias-test-realpath

📊 Changes

1 file changed (+6 additions, -2 deletions)

View changed files

📝 tests/test_mod_pack_output_alias.py (+6 -2)

📄 Description

Claimed in the coordination issue as: TEST-MOD-PACK-ALIAS-REALPATH (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7180409400)

What and why

tests/test_mod_pack_output_alias.py fails on macOS on main:

FAIL: test_alias_preflight_precedes_output_truncation (relative='mod.json')
AssertionError: ModsError not raised
FAIL: ... (relative='nested/notes.txt')
AssertionError: ModsError not raised

The test patches report_paths.os.path.samefile with a fake that answers true for the two paths it built. But report_paths.same_report_path passes samefile the os.path.realpath of each path. On macOS, tempfile's folder /var/folders/... resolves to /private/var/folders/..., so the fake never matches and the alias check never fires. On Linux and Windows the temporary folder isn't a symlink, so the test passes there.

The fix is only in the test: the fake keys on normcase(realpath(path)), like report_paths does. tools/ is unchanged.

Tested

Apple M3, macOS 26.5.1, Python 3.15, on main ad41fd517:

  • Before: 2 failures. With TMPDIR set to a folder that isn't a symlink, the old test passes, which confirms the cause.
  • After: OK, with both the default and a real TMPDIR.
  • With the alias guard in pack_mod disabled, the fixed test fails (4 failures), so it still catches the bug it was written for.
  • tests/test_report_paths.py OK.

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.

🤖 Generated with Claude Code


🔄 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/2175 **Author:** [@Tauwni](https://github.com/Tauwni) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/mod-pack-alias-test-realpath` --- ### 📝 Commits (2) - [`904dfe2`](https://github.com/ubiquitarianism/leonida/commit/904dfe2500b739fb3e2f418d3246e5f7ca70c6bf) test_mod_pack_output_alias: the fake samefile keys on realpath'd names, as report_paths does - [`011fbd3`](https://github.com/ubiquitarianism/leonida/commit/011fbd3a9ef3f8abbdf0c9dc6defc15a650e26a8) Merge main into fix/mod-pack-alias-test-realpath ### 📊 Changes **1 file changed** (+6 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_mod_pack_output_alias.py` (+6 -2) </details> ### 📄 Description Claimed in the coordination issue as: TEST-MOD-PACK-ALIAS-REALPATH (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7180409400) ### What and why `tests/test_mod_pack_output_alias.py` fails on macOS on `main`: ``` FAIL: test_alias_preflight_precedes_output_truncation (relative='mod.json') AssertionError: ModsError not raised FAIL: ... (relative='nested/notes.txt') AssertionError: ModsError not raised ``` The test patches `report_paths.os.path.samefile` with a fake that answers true for the two paths it built. But `report_paths.same_report_path` passes `samefile` the `os.path.realpath` of each path. On macOS, `tempfile`'s folder `/var/folders/...` resolves to `/private/var/folders/...`, so the fake never matches and the alias check never fires. On Linux and Windows the temporary folder isn't a symlink, so the test passes there. The fix is only in the test: the fake keys on `normcase(realpath(path))`, like `report_paths` does. `tools/` is unchanged. ### Tested Apple M3, macOS 26.5.1, Python 3.15, on `main` `ad41fd517`: - Before: 2 failures. With `TMPDIR` set to a folder that isn't a symlink, the old test passes, which confirms the cause. - After: OK, with both the default and a real `TMPDIR`. - With the alias guard in `pack_mod` disabled, the fixed test fails (4 failures), so it still catches the bug it was written for. - `tests/test_report_paths.py` OK. AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2179
No description provided.