refactor: share one derived-view cache

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 05:59:51 +01:00
1 parent 35f335d001
commit eef13547e1
8 files changed
+79 -72

No files matched your search

+2 -2
View File
@@ -54,9 +54,9 @@ class APrimaryUnderAnotherCasing(unittest.TestCase):
self.by_name.setdefault(name, []).append(sha1)
def _resolve(self, name: str) -> str:
from resolve.localfile import _casefold_index_cache, resolve_local_file
from resolve.localfile import _casefold_name_index, resolve_local_file
_casefold_index_cache.clear()
_casefold_name_index.clear()
db = {"files": self.files, "indexes": {"by_name": self.by_name, "by_md5": {},
"by_path_suffix": {}, "by_crc32": {}}}
path, _status = resolve_local_file({"name": name}, db)
+1 -2
View File
@@ -560,8 +560,7 @@ class TheArcadeCacheHoldsItsDatabase(unittest.TestCase):
return {"files": {}, "indexes": {"by_path_suffix": {"Arcade/x.zip": [sha1]}}}
def test_a_new_database_at_a_reused_address_is_read_again(self):
saved = siterender._suffix_cache[0]
self.addCleanup(siterender._suffix_cache.__setitem__, 0, saved)
self.addCleanup(siterender._arcade_suffixes.clear)
first = self._db("a" * 40)
self.assertTrue(siterender._in_arcade("a" * 40, first))
address = id(first)