mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 09:23:26 -05:00
fix: stop the MAME scrape on a clone with no pin
A failed rev-parse in the MAME clone returned an empty commit, which was cached for a day and let the merge advance the profile's version and refs while its upstream pin stayed on the previous release. The scrape now stops instead.
This commit is contained in:
1 parent
baf635cf4e
commit
e04646d67a
2 files changed
+35
-3
No files matched your search
@@ -685,5 +685,26 @@ class TestDerivativeVersion(unittest.TestCase):
|
||||
self.assertEqual(entry["source_ref"], "src/mame/philips/cdi.cpp:484")
|
||||
|
||||
|
||||
class AnUnreadableCloneStopsTheScrape(unittest.TestCase):
|
||||
"""_get_commit swallowed a failed rev-parse and returned "": cached for a
|
||||
day, the merge then advanced core_version and the refs while
|
||||
upstream_commit stayed on the previous release."""
|
||||
|
||||
def test_no_empty_commit_reaches_the_cache(self):
|
||||
import subprocess
|
||||
from unittest import mock
|
||||
|
||||
from scripts.scraper import mame_hash_scraper as scraper
|
||||
|
||||
failing = subprocess.CalledProcessError(128, ["git", "rev-parse", "HEAD"])
|
||||
with mock.patch.object(scraper, "_run_git", side_effect=failing):
|
||||
with self.assertRaises(RuntimeError):
|
||||
scraper._get_commit()
|
||||
empty = subprocess.CompletedProcess(["git"], 0, stdout="\n", stderr="")
|
||||
with mock.patch.object(scraper, "_run_git", return_value=empty):
|
||||
with self.assertRaises(RuntimeError):
|
||||
scraper._get_commit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user