refactor: read the asset registry with one parser

generate_pack kept a private .gitignore parser whose cache ignored the
root it was asked about, and generate_db a copy of the shared one. Both
now read largefiles.load_registered_paths, cached per root. Test modules
whose main block preceded their last class end with it again.
This commit is contained in:
Abdessamad Derraz committed 2026-10-17 19:35:42 +02:00
1 parent 0754d3b64f
commit 18e61fabcb
6 files changed
+57 -51

No files matched your search

+6 -5
View File
@@ -480,14 +480,14 @@ class ReleaseAssetNames(unittest.TestCase):
with tempfile.TemporaryDirectory() as root:
Path(root, ".gitignore").write_text(gitignore, encoding="utf-8")
generate_pack._GITIGNORE_ENTRIES = None
generate_pack._registered.cache_clear()
try:
manifest = {
p: generate_pack._release_asset_name(os.path.join(root, p), root)
for p in self.REGISTERED
}
finally:
generate_pack._GITIGNORE_ENTRIES = None
generate_pack._registered.cache_clear()
self.assertEqual(manifest, expected)
sizes = {self.ET: 228138631, self.RTCW: 122757192, self.PUP: 10}
@@ -677,9 +677,6 @@ class GameDataHasOneDefinition(unittest.TestCase):
)
if __name__ == "__main__":
unittest.main()
class ASameSizeReuploadIsSeen(unittest.TestCase):
"""A DSi NAND rebuilt at the same 251658304 bytes and re-uploaded with
@@ -730,3 +727,7 @@ class ASameSizeReuploadIsSeen(unittest.TestCase):
),
{"x": "abc"},
)
if __name__ == "__main__":
unittest.main()