Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/test_mod_pack_output_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading