mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
feat: record the commit a branch scrape read
Six platforms are read from a branch: System.dat, batocera-systems.json, checkBIOS.sh, the MiSTer BiosDB, the RetroPie scriptmodules and the RetroDECK component manifests. Their YAML named the branch, so the native export patched whatever the branch had become since the scrape. Each scraper now resolves the branch head once, reads every file at that commit and writes it into source. The export follows a recorded tarball and a recorded tree as it already followed a raw file URL.
This commit is contained in:
1 parent
eafb73bf55
commit
16f6ef8cbf
17 files changed
+203
-38
No files matched your search
@@ -34,6 +34,8 @@ class _Response(io.BytesIO):
|
||||
def _opener(failure):
|
||||
def urlopen(req, timeout=0):
|
||||
url = req.full_url
|
||||
if "/commits/" in url:
|
||||
return _Response(json.dumps({"sha": "a" * 40}).encode())
|
||||
if "api.github.com" in url:
|
||||
return _Response(json.dumps(TREE).encode())
|
||||
if "pcsx2" in url and failure is not None:
|
||||
@@ -60,6 +62,20 @@ class ManifestErrors(unittest.TestCase):
|
||||
error = urllib.error.HTTPError("u", 404, "not found", {}, None)
|
||||
self.assertEqual([name for name, _ in self.fetch(error)], ["ppsspp"])
|
||||
|
||||
def test_the_tree_and_files_are_read_at_one_commit(self):
|
||||
seen = []
|
||||
opener = _opener(None)
|
||||
|
||||
def recording(req, timeout=0):
|
||||
seen.append(req.full_url)
|
||||
return opener(req, timeout)
|
||||
|
||||
with mock.patch("urllib.request.urlopen", recording):
|
||||
Scraper()._fetch_remote_manifests()
|
||||
reads = [url for url in seen if "/commits/" not in url]
|
||||
self.assertTrue(reads)
|
||||
self.assertTrue(all("a" * 40 in url for url in reads), reads)
|
||||
|
||||
def test_a_truncated_tree_stops_the_scrape(self):
|
||||
TREE["truncated"] = True
|
||||
self.addCleanup(TREE.pop, "truncated")
|
||||
|
||||
Reference in new issue
Block a user