From 904dfe2500b739fb3e2f418d3246e5f7ca70c6bf Mon Sep 17 00:00:00 2001 From: Tauwni <102470988+Tauwni@users.noreply.github.com> Date: Thu, 26 Nov 2026 03:03:04 +0100 Subject: [PATCH] test_mod_pack_output_alias: the fake samefile keys on realpath'd names, as report_paths does On macOS the temporary folder /var/... resolves to /private/var/..., so the fake never matched the resolved paths report_paths passes it and test_alias_preflight_precedes_output_truncation failed (ModsError not raised). Co-Authored-By: Claude Opus 5.5 --- tests/test_mod_pack_output_alias.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_mod_pack_output_alias.py b/tests/test_mod_pack_output_alias.py index b11ccca5ef..8f75cc746d 100644 --- a/tests/test_mod_pack_output_alias.py +++ b/tests/test_mod_pack_output_alias.py @@ -34,9 +34,13 @@ def test_alias_preflight_precedes_output_truncation(self): before = source.read_bytes() output = root / "packed.zip" output.write_bytes(before) - aliases = {os.path.normcase(str(source)), os.path.normcase(str(output))} + # report_paths compares realpath'd names; on macOS the temporary folder /var/... resolves to + # /private/var/..., so the fake answer keys on the resolved spellings too. + def key(path): + return os.path.normcase(os.path.realpath(str(path))) + aliases = {key(source), key(output)} def samefile(a, b): - return {os.path.normcase(str(a)), os.path.normcase(str(b))} == aliases + return {key(a), key(b)} == aliases with mock.patch("report_paths.os.path.samefile", side_effect=samefile): with self.assertRaisesRegex(mods.ModsError, "aliases a file"): mods.pack_mod(str(root / "mods"), "sample", str(output), True)