mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-28 22:57:19 -05:00
chore: merge main into the interface branch
This commit is contained in:
commit
e00880b6a1
209 files changed
+3620
-1816
No files matched your search
@@ -1093,6 +1093,19 @@ class ThePlatformsOwnSystemNamesAreAccepted(unittest.TestCase):
|
||||
self.assertIn('"system_names": platform_system_names(config, list(pack_systems))',
|
||||
source)
|
||||
|
||||
def test_every_listed_system_gets_the_title_the_site_prints(self):
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
from generate_pack import system_titles # noqa: PLC0415
|
||||
|
||||
files = [{"dest": "a.bin", "systems": ["sony-playstation", "nintendo-gba"]}]
|
||||
omitted = [{"dest": "b.bin", "systems": ["3do"]}]
|
||||
self.assertEqual(system_titles(files, omitted), {
|
||||
"3do": "3DO",
|
||||
"nintendo-gba": "Nintendo Game Boy Advance",
|
||||
"sony-playstation": "Sony PlayStation",
|
||||
})
|
||||
self.assertEqual(system_titles([{"dest": "c.bin", "systems": ["sys-a"]}]), {})
|
||||
|
||||
def test_a_native_name_narrows_and_lists(self):
|
||||
with FakeRepository() as repo:
|
||||
path = repo.root / "install" / "retroarch.json"
|
||||
|
||||
@@ -2723,6 +2723,21 @@ class TestWriteDryRun(unittest.TestCase):
|
||||
self.assertNotIn("source_commit", output)
|
||||
self.assertEqual(self.path.read_text(), before)
|
||||
|
||||
def test_a_bump_that_leaves_stale_prose_is_rolled_back(self):
|
||||
"""dolphin-mmjr2, hatari, xenios: the bump moved upstream_commit only,
|
||||
and prose the report had judged in the fork fell under the new
|
||||
upstream pin. The guard had read it under the old pins."""
|
||||
from unittest import mock
|
||||
|
||||
before = self.path.read_text()
|
||||
answers = iter([[], ["notes: a.c:10 (a.c:10 changed)"]])
|
||||
with mock.patch.object(
|
||||
profile_sync, "realign_prose", side_effect=lambda *a, **k: next(answers)
|
||||
), contextlib.redirect_stderr(io.StringIO()) as err:
|
||||
self._run(self._args(rebase_refs=True, dry_run=False), self._shifted())
|
||||
self.assertEqual(self.path.read_text(), before)
|
||||
self.assertIn("nothing was written", err.getvalue())
|
||||
|
||||
def test_a_planned_bump_reads_the_prose_the_rebase_would_have_left(self):
|
||||
"""The pin is blocked by prose until the rebase moves it.
|
||||
|
||||
@@ -3152,6 +3167,7 @@ class TestCheckVersion(unittest.TestCase):
|
||||
"tagsha" if tag == "v3.0.0" else None
|
||||
)
|
||||
)
|
||||
profile_sync.upstream.tag_commit = profile_sync.upstream.resolve_tag_commit
|
||||
|
||||
def tearDown(self):
|
||||
(
|
||||
@@ -4530,6 +4546,19 @@ class TestEmulatorsDirStatus(unittest.TestCase):
|
||||
Path(root, "a.yml").write_text("emulator: a\n")
|
||||
self.assertTrue(profile_sync.emulators_dir_is_dirty(root))
|
||||
|
||||
def test_only_the_selected_profiles_count(self):
|
||||
# A loop of --emulator X --rebase-refs refused every profile after
|
||||
# the first one it wrote.
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
self._git("init", "-q", cwd=root)
|
||||
Path(root, "a.yml").write_text("emulator: a\n")
|
||||
Path(root, "b.yml").write_text("emulator: b\n")
|
||||
self._git("add", "a.yml", "b.yml", cwd=root)
|
||||
self._git("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "p", cwd=root)
|
||||
Path(root, "a.yml").write_text("emulator: a2\n")
|
||||
self.assertTrue(profile_sync.emulators_dir_is_dirty(root, ["a"]))
|
||||
self.assertFalse(profile_sync.emulators_dir_is_dirty(root, ["b"]))
|
||||
|
||||
def test_a_tree_outside_any_repository_is_not_clean(self):
|
||||
with tempfile.TemporaryDirectory() as root, mock.patch.dict(
|
||||
os.environ, {"GIT_CEILING_DIRECTORIES": str(Path(root).parent)}
|
||||
|
||||
@@ -910,5 +910,52 @@ class TestCurrentSlug(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
|
||||
class TestNewestTag(unittest.TestCase):
|
||||
"""GitHub's REST tag list is sorted by name: nesoid lists 2.5 before
|
||||
2.5-4, so the first entry was reported as the latest tag."""
|
||||
|
||||
def setUp(self):
|
||||
self.tmp = tempfile.TemporaryDirectory()
|
||||
self.repo = make_repo("github.com", "o", "n")
|
||||
self.saved = (upstream._github_graphql, upstream.list_tags)
|
||||
upstream.list_tags = lambda repo, cache, offline=False: ["2.5", "2.5-4"]
|
||||
|
||||
def tearDown(self):
|
||||
upstream._github_graphql, upstream.list_tags = self.saved
|
||||
self.tmp.cleanup()
|
||||
|
||||
def test_commit_date_order_wins(self):
|
||||
upstream._github_graphql = lambda *a: {
|
||||
"data": {"repository": {"refs": {"nodes": [{"name": "2.5-4"}]}}}
|
||||
}
|
||||
self.assertEqual(upstream.newest_tag(self.repo, self.tmp.name), "2.5-4")
|
||||
|
||||
def test_without_a_token_the_forge_order_stays(self):
|
||||
upstream._github_graphql = lambda *a: None
|
||||
self.assertEqual(upstream.newest_tag(self.repo, self.tmp.name), "2.5")
|
||||
|
||||
|
||||
class TestNamedTagCommit(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.tmp = tempfile.TemporaryDirectory()
|
||||
self.saved = upstream._http_json
|
||||
|
||||
def tearDown(self):
|
||||
upstream._http_json = self.saved
|
||||
self.tmp.cleanup()
|
||||
|
||||
def test_gitlab_tag_is_asked_by_name(self):
|
||||
asked = []
|
||||
|
||||
def answer(url):
|
||||
asked.append(url)
|
||||
return {"name": "1.2.35", "commit": {"id": "c74fc36"}}
|
||||
|
||||
upstream._http_json = answer
|
||||
repo = parse_repo("https://gitlab.com/jengun/sdltrs")
|
||||
self.assertEqual(upstream.tag_commit(repo, "1.2.35", self.tmp.name), "c74fc36")
|
||||
self.assertTrue(asked[0].endswith("/repository/tags/1.2.35"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user