mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-28 20:38:52 -06:00
fix: remove the games cache scratch on a failure
A cache write that failed left index.json.<pid>.part behind, one more on each run. The cache and the install record now write through one scratch file beside the target, removed when the write fails and named when it cannot be.
This commit is contained in:
1 parent
5d0c2fd3c6
commit
bf34e71804
8 files changed
+59
-43
No files matched your search
@@ -758,6 +758,13 @@ class Cache(GamesTestCase):
|
||||
self.assertEqual(len(counted), 2)
|
||||
self.assertEqual(plan.games[0].dat_regions, frozenset({"japan"}))
|
||||
|
||||
def test_a_cache_write_that_fails_leaves_no_scratch(self):
|
||||
# Each failing run left one index.json.<pid>.part beside the cache.
|
||||
cached = self.card.cache / "games"
|
||||
(cached / "index.json").mkdir(parents=True)
|
||||
install._cache_write(cached / "index.json", b"{}")
|
||||
self.assertEqual([p.name for p in cached.iterdir()], ["index.json"])
|
||||
|
||||
def test_the_index_is_cached_and_read_offline_without_the_list_beside_it(self):
|
||||
self.card.game("MD", "eu.md", MD_EU)
|
||||
index = (self.card.lists / "games" / "index.json").read_bytes()
|
||||
|
||||
Reference in new issue
Block a user