From b0e98942752930bfe5f44f48c6bf28428ded0f1c Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:15:39 +0200 Subject: [PATCH] chore: test --from around the BIOS folder An archive the run replaces gives no member to copy: the lookup that skips it came with the one-pass index, this test holds it. --- tests/test_install_from.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_install_from.py b/tests/test_install_from.py index d8f7d129..9c04d1af 100644 --- a/tests/test_install_from.py +++ b/tests/test_install_from.py @@ -748,6 +748,25 @@ class WhereTheSearchGoes(FromFolder): self.assertLess(kinds.index("scanned"), kinds.index("detect")) +class AFolderAroundTheBiosFolder(FromFolder): + """--from names a folder holding the BIOS folder: an archive this run + replaces was a source of members while it was being written.""" + + def test_an_archive_being_replaced_gives_no_member(self): + new_set = b"the archive the list installs" * 4 + inner = b"a rom inside the old archive" * 3 + _zip(self.dest / "set.zip", {"inner.bin": inner}) + files = [_entry("set.zip", new_set, ["x"]), _entry("inner.bin", inner, ["x"])] + around = install.FolderIndex(self.root) + copies = install.plan_local_copies(files, self.dest, None, [around]) + self.assertEqual(copies, {}) + _zip(self.old / "copy.zip", {"inner.bin": inner}) + copies = install.plan_local_copies(files, self.dest, None, + [install.FolderIndex(self.root)]) + self.assertEqual([copies[id(e)].where() for e in files if id(e) in copies], + ["old card/copy.zip, inside as inner.bin"]) + + class ManySameSizedFiles(FromFolder): """A card of 16 KB ROMs and a list of 16 KB entries: each entry sorted and walked every file of its size."""