chore: merge site fixes

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 18:17:24 +01:00
commit 5b6feef785
286 files changed
+2851 -285

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
"""A disposable copy of the checkout, for tests that run a writer and expect
it to refuse.
Run in the checkout, a regression made the very write the test guards
against: generate_site rewrote website/src/data/published-parts.json and the
FAQ page whatever --docs-dir said, and a pipeline whose lock probe failed
would regenerate database.json and install/. A file another session had
already changed listed the same name in `git diff --name-only` before and
after, so its edits were lost without a signal.
The copy holds every file git tracks or would track, as the working tree has
it. bios/ and data/ (17 GB and 600 MB of inputs no such test writes) are
links to the checkout's.
"""
from __future__ import annotations
import atexit
import hashlib
import os
import shutil
import subprocess
import tempfile
from functools import cache
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
LINKED = ("bios", "data")
@cache
def scratch_checkout() -> Path:
"""The copy, built once per test process and removed at its exit."""
root = Path(tempfile.mkdtemp(prefix="checkout-", dir=REPO_ROOT / "tmp" / "tests"))
# A detached worktree with nothing checked out: the scripts that read
# HEAD (the site's bootstrap pin) find this commit.
subprocess.run(
["git", "worktree", "add", "--quiet", "--detach", "--no-checkout", str(root), "HEAD"],
cwd=REPO_ROOT, capture_output=True, check=True,
)
atexit.register(_remove, root)
listed = subprocess.run(
["git", "ls-files", "-z", "--cached", "--others", "--exclude-standard"],
cwd=REPO_ROOT, capture_output=True, check=True,
).stdout.decode("utf-8")
for name in filter(None, listed.split("\0")):
source = REPO_ROOT / name
if name.split("/", 1)[0] in LINKED or not source.is_file() or source.is_symlink():
continue
target = root / name
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(source, target)
for name in LINKED:
if (REPO_ROOT / name).exists():
(root / name).symlink_to(REPO_ROOT / name, target_is_directory=True)
return root
def _remove(root: Path) -> None:
subprocess.run(["git", "worktree", "remove", "--force", str(root)],
cwd=REPO_ROOT, capture_output=True, check=False)
shutil.rmtree(root, ignore_errors=True)
def snapshot(root: Path) -> dict[str, str]:
"""The SHA-1 of every file under root, links not followed. A file
written with the bytes it held is no change: what is caught is a file
whose content a run replaced. Scratch space, caches, bytecode and lock
files are no output."""
seen = {}
for directory, dirs, files in os.walk(root):
dirs[:] = [d for d in dirs if d != "__pycache__"
and Path(directory, d) not in (root / "tmp", root / ".cache")]
for name in files:
path = Path(directory) / name
if name != ".lock" and not path.is_symlink():
seen[str(path.relative_to(root))] = hashlib.sha1(path.read_bytes()).hexdigest()
return seen
+2
View File
@@ -9,6 +9,8 @@ corrected it later, every other reader of the resolution did not.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import json
import shutil
+2
View File
@@ -12,6 +12,8 @@ BIOS root of platforms that do not run that emulator.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import sys
import tempfile
+2
View File
@@ -8,6 +8,8 @@ libretro core, while verify set the entry aside. Reads the repository.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import unittest
+2
View File
@@ -9,6 +9,8 @@ was not where it looks.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import sys
+2
View File
@@ -7,6 +7,8 @@ the slot missing and the manifest omitted it.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import re
import sys
import tempfile
+2
View File
@@ -8,6 +8,8 @@ the firmware of cores its image never had.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import io
import json
import tempfile
+2
View File
@@ -7,6 +7,8 @@ seven of the eight members Batocera checks were missing.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import shutil
+2
View File
@@ -9,6 +9,8 @@ those members were never read there, and the archive matched no recipe.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import sys
import unittest
+13 -6
View File
@@ -7,6 +7,8 @@ ZIPs, which surfaces as BadZipFile far from its cause.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import subprocess
import sys
@@ -25,6 +27,7 @@ from common import ( # noqa: E402
hold_repository_outputs,
publish_hold,
)
from tests.scratchtree import scratch_checkout # noqa: E402
def _tempdir(test: unittest.TestCase) -> str:
@@ -115,11 +118,13 @@ class PackLockCliTest(unittest.TestCase):
self.dir = _tempdir(self)
def _run(self, argv: list[str]) -> subprocess.CompletedProcess:
# In a copy: a pipeline that missed the lock regenerated
# database.json and install/ wherever it ran.
return subprocess.run(
[sys.executable, *argv],
capture_output=True,
text=True,
cwd=str(REPO_ROOT),
cwd=str(scratch_checkout()),
timeout=300,
)
@@ -234,11 +239,12 @@ class PipelineHoldsItsFixedOutputs(unittest.TestCase):
def test_a_second_pipeline_is_refused_whatever_its_output_dir(self):
scratch = _tempdir(self)
with hold_repository_outputs(str(REPO_ROOT)):
checkout = scratch_checkout()
with hold_repository_outputs(str(checkout)):
proc = subprocess.run(
[sys.executable, "scripts/pipeline.py", "--offline", "--skip-docs",
"--output-dir", scratch],
capture_output=True, text=True, cwd=str(REPO_ROOT), timeout=120,
capture_output=True, text=True, cwd=str(checkout), timeout=120,
)
self.assertEqual(proc.returncode, 1, proc.stdout + proc.stderr)
self.assertIn("another run is writing database.json", proc.stderr)
@@ -260,11 +266,12 @@ class StandaloneWritersHonourTheRepositoryHold(unittest.TestCase):
env = {k: v for k, v in os.environ.items() if k != "RETROBIOS_HELD_ARTIFACT_DIR"}
return subprocess.run(
[sys.executable, *argv], capture_output=True, text=True,
cwd=str(REPO_ROOT), timeout=300, env=env, check=False,
cwd=str(scratch_checkout()), timeout=300, env=env, check=False,
)
def test_a_writer_of_a_fixed_output_is_refused(self):
with hold_repository_outputs(str(REPO_ROOT)):
# The writers run in a copy, where a missed lock writes nothing of ours.
with hold_repository_outputs(str(scratch_checkout())):
for argv in (
["scripts/generate_db.py", "--bios-dir", "bios", "--output", "database.json"],
["scripts/generate_pack.py", "--all", "--manifest", "--offline",
@@ -369,7 +376,7 @@ class SiteGenerationHoldsDocs(unittest.TestCase):
with artifact_lock(docs):
result = subprocess.run(
[sys.executable, "scripts/generate_site.py", "--docs-dir", docs],
cwd=REPO_ROOT, capture_output=True, text=True, timeout=600,
cwd=scratch_checkout(), capture_output=True, text=True, timeout=600,
)
self.assertEqual(result.returncode, 1, result.stdout + result.stderr)
self.assertIn("in use by another run", result.stderr)
+2
View File
@@ -8,6 +8,8 @@ path in bios/: a scan running beside the copy hashed the truncated file.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import tempfile
+161 -1
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import ast
import contextlib
import hashlib
@@ -136,6 +138,41 @@ class ReadmeRegressions(unittest.TestCase):
self.assertNotIn("SyntaxError", proc.stderr)
self.assertIn("generate_pack.py needs Python 3.9", proc.stderr)
def test_every_script_names_the_floor_under_an_older_interpreter(self):
"""Only generate_pack.py and pipeline.py checked the version. verify.py,
slots.py, validate_pr.py and cross_reference.py started under 3.8 and
stopped halfway on a str.removeprefix AttributeError."""
import shutil # noqa: PLC0415
python38 = shutil.which("python3.8")
if python38 is None:
if os.environ.get("CI"):
self.fail("CI must provide python3.8")
self.skipTest("no python3.8 on PATH")
commands = (
["verify.py", "--emulator", "handy"],
["verify.py", "--platform", "batocera"],
["validate_pr.py", "--json", "README.md"],
["cross_reference.py", "--emulator", "handy"],
["slots.py"],
["identity.py"],
["generate_site.py", "--help"],
["campaign.py", "--help"],
["region_check.py", "--help"],
)
for command in commands:
with self.subTest(command=" ".join(command)):
# -E -s rather than -I: -I drops the script's folder from
# sys.path, so the imports would fail before any check.
proc = subprocess.run(
[python38, "-E", "-s", f"scripts/{command[0]}", *command[1:]],
cwd=ROOT, capture_output=True, text=True, timeout=60,
check=False,
)
self.assertEqual(proc.returncode, 1, proc.stderr)
self.assertNotIn("Traceback", proc.stderr)
self.assertIn(f"{command[0]} needs Python 3.9", proc.stderr)
def test_the_floor_interpreter_imports_every_script(self):
"""Every module under scripts/ is loaded by a real interpreter of the
floor version, as the installer's 3.8 floor is proven by running it.
@@ -218,6 +255,46 @@ class AModuleRunAloneHasItsScratchDirectory(unittest.TestCase):
self.assertEqual(proc.stdout.split(), [scratch, scratch])
class EveryTestModuleImportsTheIsolation(unittest.TestCase):
"""tests/__init__.py keeps a run offline, its scratch under tmp/ and its
installer cache its own, but only `discover -s tests -t .` imported it:
`discover tests` ran with RETROBIOS_OFFLINE unset, scratch in /tmp and
the user's real cache. Each module now imports the package first."""
def test_the_package_import_comes_before_any_other(self):
missing = []
for path in sorted((ROOT / "tests").glob("test_*.py")):
body = ast.parse(path.read_text(encoding="utf-8")).body
imports = [
node for node in body
if isinstance(node, (ast.Import, ast.ImportFrom))
and getattr(node, "module", None) != "__future__"
]
first = imports[0] if imports else None
if not (isinstance(first, ast.Import)
and [alias.name for alias in first.names] == ["tests"]):
missing.append(path.name)
self.assertEqual(missing, [])
def test_discover_without_a_top_level_runs_isolated(self):
env = {k: v for k, v in os.environ.items()
if k not in ("RETROBIOS_OFFLINE", "TMPDIR", "RETROBIOS_CACHE")}
proc = subprocess.run(
[sys.executable, "-c",
"import os, sys, tempfile, unittest\n"
"unittest.TestLoader().discover('tests', pattern='test_artifact_lock.py')\n"
"print(os.environ.get('RETROBIOS_OFFLINE'), tempfile.gettempdir(),"
" os.environ.get('RETROBIOS_CACHE'))\n"],
cwd=ROOT, env=env, capture_output=True, text=True, timeout=120,
check=False,
)
self.assertEqual(proc.returncode, 0, proc.stderr)
offline, scratch, cache = proc.stdout.split()
self.assertEqual(offline, "1")
self.assertEqual(scratch, str(ROOT / "tmp" / "tests"))
self.assertEqual(cache, str(ROOT / "tmp" / "tests" / "cache"))
class ReleaseSigningRegressions(unittest.TestCase):
"""A checksum list published beside its own artifacts proves nothing.
@@ -2834,6 +2911,50 @@ class DeclaredDependenciesMatchTheDocumentedWorkflows(unittest.TestCase):
)
class TheAnnotationsAreChecked(unittest.TestCase):
"""Every signature carried type hints and nothing read them: six pack
helpers declared `zipfile.ZipFile` while every caller also passed a
PackRecord, and 990 such contradictions went through CI green. mypy now
runs in CI against mypy-baseline.txt, the errors the code carried when the
check started."""
BASELINE = ROOT / "mypy-baseline.txt"
ENTRY = re.compile(r"(?P<path>[^:]+\.py):0: error: .+ \[[a-z-]+\]")
def test_ci_holds_the_code_to_the_baseline(self):
body = (ROOT / ".github" / "workflows" / "validate.yml").read_text(
encoding="utf-8"
)
self.assertIn("mypy-baseline filter", body)
self.assertNotIn("--allow-unsynced", body)
def test_every_baseline_entry_names_a_file_that_exists(self):
stale = []
for line in self.BASELINE.read_text(encoding="utf-8").splitlines():
match = self.ENTRY.fullmatch(line)
self.assertIsNotNone(match, f"unreadable baseline entry: {line}")
if not (ROOT / match["path"]).is_file():
stale.append(match["path"])
self.assertEqual(stale, [], "baseline entries for files that are gone")
def test_the_code_reports_no_error_outside_the_baseline(self):
for module in ("mypy", "mypy_baseline"):
try:
__import__(module)
except ImportError:
self.skipTest(f"{module} is not installed (pip install -e '.[dev]')")
report = subprocess.run(
[sys.executable, "-m", "mypy"],
cwd=ROOT, capture_output=True, text=True, check=False,
)
result = subprocess.run(
[sys.executable, "-m", "mypy_baseline", "filter", "--no-colors"],
cwd=ROOT, input=report.stdout, capture_output=True, text=True,
check=False,
)
self.assertEqual(result.returncode, 0, result.stdout)
class TheProjectInstallsWithPip(unittest.TestCase):
"""pyproject declared a dev extra that pip could not install: without a
[build-system] and an explicit module list, setuptools' flat-layout
@@ -4991,9 +5112,34 @@ class VerifyAllSummaryNamesWhatIsWrong(unittest.TestCase):
[(clean, ["RetroArch"]), (warned, ["RetroDECK"]), (core_miss, ["ROCKNIX"])]
)
self.assertIn("1 warning (RetroDECK 1)", summary)
self.assertIn("ROCKNIX: n64.psh", summary)
self.assertIn("n64.psh (ROCKNIX)", summary)
self.assertIn("0 critical,", summary)
def test_a_file_missing_on_several_platforms_is_counted_once(self):
"""sfiii2a.zip missing on 15 platforms read '24 core file(s)' for 10
distinct files, the name printed 15 times on one line."""
sys.path.insert(0, str(ROOT / "scripts"))
import verify
def missing(*names: str) -> dict:
return {"severity_counts": {}, "undeclared_files": [
{"name": name, "required": True, "in_repo": False,
"category": "bios", "in_pack": True} for name in names
]}
summary = verify._overall_summary([
(missing("sfiii2a.zip"), ["Batocera"]),
(missing("sfiii2a.zip", "ROM"), ["RetroPie"]),
(missing("sfiii2a.zip"), ["RomM"]),
(missing(), ["MinUI"]),
])
self.assertIn(
"2 core file(s) a core cannot run without are missing: "
"sfiii2a.zip (every platform but MinUI); ROM (RetroPie)",
summary,
)
self.assertEqual(summary.count("sfiii2a.zip"), 1)
class OneOutputFormPerRun(unittest.TestCase):
@@ -5956,6 +6102,20 @@ class TheRepairCommandWritesTheFileNamed(unittest.TestCase):
load_database(target)
self.assertIn(f"--output {target}", str(caught.exception))
def test_a_typo_beside_the_database_names_the_database(self):
"""--db databse.json beside database.json was told to rescan the whole
collection into a second file named after the typo."""
from scripts.common import DatabaseUnreadable, load_database
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as directory:
(Path(directory) / "database.json").write_text("{}")
typo = Path(directory) / "databse.json"
with self.assertRaises(DatabaseUnreadable) as caught:
load_database(str(typo))
message = str(caught.exception)
self.assertIn(f"Did you mean {typo.with_name('database.json')}?", message)
self.assertNotIn("generate_db.py", message)
class VerifyPacksRefusesWhatItCannotDo(unittest.TestCase):
"""The --verify-packs refusals lived in the --all-variants checks, which
+2
View File
@@ -7,6 +7,8 @@ a function returning canned CI runs.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import io
import json
+2
View File
@@ -9,6 +9,8 @@ under it: amiberry, fsuae and vice were never in a target list.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -9,6 +9,8 @@ a list, and verify accepts any listed md5.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import sys
import tempfile
+2
View File
@@ -9,6 +9,8 @@ the Batocera BIOS folder.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -7,6 +7,8 @@ Oric and Tangerine: one machine, two folders, two pages.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import subprocess
import unittest
from pathlib import Path
+2
View File
@@ -13,6 +13,8 @@ entry is written with the hash of the file the emulator ships.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import sys
import unittest
+2
View File
@@ -10,6 +10,8 @@ directory cache is not a collection.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import unittest
+2
View File
@@ -10,6 +10,8 @@ resume and rerun on a changed core.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import hashlib
import io
+2
View File
@@ -7,6 +7,8 @@ went red. The flag lived in retrobat.yml and vanished at the next scrape.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import hashlib
import io
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+39 -4
View File
@@ -8,6 +8,8 @@ report is folded, since each of those decides whether a row says STALE.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import os
import sys
@@ -316,8 +318,23 @@ class CoreResolutionTests(unittest.TestCase):
record.write_text(cf.json.dumps({"blobs": {"a": "1", "b": "1"}}))
cf.record_core_info({"a": "2", "b": "2"}, ["a"], record)
self.assertEqual(cf.load_core_info_record(record), {"a": "2", "b": "1"})
with self.assertRaises(ValueError):
cf.record_core_info({"a": "2"}, ["ghost"], record)
with self.assertRaises(cf.InputMissing) as raised:
cf.record_core_info({"a": "2", "ghosts": "1"}, ["ghost"], record)
self.assertIn("Did you mean: ghosts?", str(raised.exception))
def test_record_errors_are_one_line(self):
"""A mistyped core and an empty offline cache ended on a traceback."""
import subprocess # noqa: PLC0415
with tempfile.TemporaryDirectory() as tmp:
proc = subprocess.run(
[sys.executable, str(REPO_ROOT / "scripts" / "check_freshness.py"), "--offline",
"--cache-dir", tmp, "--record-coreinfo"],
capture_output=True, text=True, check=False, timeout=120,
)
self.assertEqual(proc.returncode, 1)
self.assertNotIn("Traceback", proc.stderr)
self.assertIn("run without --offline", proc.stderr)
def test_offline_without_a_cached_listing_is_skipped(self):
"""Offline, the row read UNKNOWN and failed the run as an upstream
@@ -460,10 +477,28 @@ class CatalogParsingTests(unittest.TestCase):
row = cf._check_redump_games(False)
self.assertEqual((row.status, row.items), (cf.STALE, ["sony-playstation"]))
self.assertEqual(cf._check_redump_games(True).status, cf.SKIPPED)
with mock.patch.object(cf, "_game_catalogs", return_value=[{"fetched": "2026-11-03"}]):
for rebuilt, status in (("2026-07-08", cf.OK), ("2026-11-04", cf.STALE)):
with mock.patch.object(cf, "_game_catalogs", return_value=[{"fetched": "2026-11-03"}]), \
mock.patch.object(cf, "_today", return_value="2026-11-06"):
for rebuilt, status in (("2026-11-02", cf.OK), ("2026-11-04", cf.STALE)):
with mock.patch.object(cf, "_no_intro_asset_date", return_value=rebuilt):
self.assertEqual(cf._check_nointro_games("", False).status, status)
def test_a_mirror_that_stopped_rebuilding_is_stale(self):
"""The mirror failed every daily rebuild from 2026-07-08, and both
No-Intro rows read OK: an import newer than a dead pack is no
sign of a fresh catalog."""
with mock.patch.object(cf, "_today", return_value="2026-11-06"), \
mock.patch.object(cf, "_no_intro_asset_date", return_value="2026-07-08"), \
mock.patch.object(cf, "_game_catalogs", return_value=[{"fetched": "2026-11-03"}]), \
mock.patch.object(cf, "_snapshot", return_value={"imported_at": "2026-08-08"}):
for row in (cf._check_nointro_games("", False), cf._check_no_intro("", False)):
self.assertEqual(row.status, cf.STALE)
self.assertIn("2026-07-08, 121 days ago", row.detail)
def test_the_freshness_check_reads_the_importer_mirror(self):
self.assertEqual(cf.NO_INTRO_MIRROR, cf.game_dat_importer.NOINTRO_MIRROR)
self.assertIn(cf.NO_INTRO_MIRROR.removeprefix("https://github.com/"),
cf.game_dat_importer.NOINTRO_RELEASE_API)
self.assertIn("no-intro games",
[f.subject for f in cf.check_catalogs("", True)])
+2
View File
@@ -7,6 +7,8 @@ whose checksums every user's `sha256sum --check` rejected.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -6,6 +6,8 @@ one. validate_schemas now refuses it.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import subprocess
import sys
import unittest
+2
View File
@@ -7,6 +7,8 @@ does not hold the file.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import re
import sys
import unittest
+2
View File
@@ -6,6 +6,8 @@ the repository, five on the site, under two different titles.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import re
import sys
import unittest
+2
View File
@@ -10,6 +10,8 @@ reader now gets the tree, or the profile says its package installs it.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import unittest
@@ -8,6 +8,8 @@ frontend sees a file at the path. verify kept it MISSING, so the pack said
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import contextlib
import io
+2
View File
@@ -7,6 +7,8 @@ probe on it: staging, the worker process, strace, the record and its schema.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import argparse
import contextlib
import hashlib
+2
View File
@@ -10,6 +10,8 @@ read one rule (validation.core_size_refusal).
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import sys
+2
View File
@@ -9,6 +9,8 @@ tests change an input and expect a fresh computation.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import tempfile
import unittest
+2
View File
@@ -9,6 +9,8 @@ a directory called ROM).
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import tempfile
import unittest
+2
View File
@@ -7,6 +7,8 @@ contributor with none of them.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import ast
import sys
import unittest
+2
View File
@@ -18,6 +18,8 @@ Layouts, from Azahar src/core/hw/unique_data.cpp and src/core/file_sys/otp.cpp:
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import struct
import sys
+2
View File
@@ -14,6 +14,8 @@ constants rather than against itself. The AES vector is from NIST SP 800-38A.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import shutil
import sys
+2
View File
@@ -6,6 +6,8 @@ verify only said "not cached" and refresh_data_dirs had nothing to fetch.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -7,6 +7,8 @@ TypeError on the first loop.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import ast
import unittest
from pathlib import Path
+2
View File
@@ -8,6 +8,8 @@ disk ROM then served the CoCo one.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import tempfile
+2
View File
@@ -8,6 +8,8 @@ set, enriched with every spelling the database knows.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -9,6 +9,8 @@ are both load-bearing.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import io
import os
+2
View File
@@ -7,6 +7,8 @@ is two held ROMs end to end. The gap report listed them as acquisition targets.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import shutil
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import tempfile
+2
View File
@@ -9,6 +9,8 @@ reported missing while 3 584 collected files stayed out of every pack.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import json
import sys
+2
View File
@@ -7,6 +7,8 @@ code moves, and nothing else notices.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import ast
import hashlib
import inspect
+2
View File
@@ -9,6 +9,8 @@ tool prints, and a size is the one the release record holds.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import ast
import contextlib
import re
+2
View File
@@ -9,6 +9,8 @@ checksum of each layout and the staging location.
"""
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import functools
import hashlib
+2
View File
@@ -17,6 +17,8 @@ Covers:
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import hashlib
import io
+2
View File
@@ -9,6 +9,8 @@ upstream files.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -9,6 +9,8 @@ firmware of cores its image never had.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import sys
import unittest
+2
View File
@@ -9,6 +9,8 @@ names and ten "missing".
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import re
import subprocess
import sys
+2
View File
@@ -6,6 +6,8 @@ from what the cores the platform runs open, never from the entry's name.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -9,6 +9,8 @@ from a file other than the one the hash describes.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import sys
import unittest
+2
View File
@@ -9,6 +9,8 @@ libretro's System.dat (N88EXT0-3.ROM) as if libretro declared them.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import tempfile
import unittest
+2
View File
@@ -7,6 +7,8 @@ file from and no list to check the diff against.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import re
import sys
import tempfile
+74 -2
View File
@@ -14,6 +14,8 @@ and skip when it has not been populated (python scripts/export_native.py
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import difflib
import io
import json
@@ -801,14 +803,20 @@ class SearchOrder(unittest.TestCase):
longest = ('rp_module_id="xm7"\nrp_module_help="Copy bios files '
+ ", ".join(f"n{i}.rom" for i in range(12)) + ' and n12.rom to $biosdir"\n')
exporter = discover_exporters()["retropie"]()
produced = exporter.render(
written = exporter.render(
systems, None,
{"scriptmodules/libretrocores/lr-flycast.sh": script,
"scriptmodules/emulators/xm7.sh": longest},
)["scriptmodules/libretrocores/lr-flycast.sh"]
)
produced = written["scriptmodules/libretrocores/lr-flycast.sh"]
self.assertIn("Dreamcast BIOS file dc_boot.bin to", produced)
self.assertIn("BIOS files naomi.zip, awbios.zip and naomi2.zip to", produced)
self.assertNotIn("other.zip", produced)
# Rewritten for naomi2.zip, other.zip left out: the summary said
# "Left as is" of a package in the diff.
outcome = exporter.outcome(systems, written)
self.assertIn("Updated in part: lr-flycast,", outcome)
self.assertNotIn("Left as is: lr-flycast", outcome)
def test_cores_that_disagree_keep_the_best_rank(self):
"""Nothing is dropped on the rank here, so the best one wins.
@@ -827,6 +835,70 @@ class SearchOrder(unittest.TestCase):
self.assertEqual(entry.priority, 2)
class TwoAdditionsAtOnePath(unittest.TestCase):
"""Two cores declaring two dumps of one file the platform lacks: both
were counted added while the render wrote one. Recalbox's md5 list takes
both, a System.dat name and a RetroDECK path hold one."""
A, B = "615a" + "0" * 28, "ef49" + "0" * 28
def _addition(self, md5: str, core: str, system: str = "dos") -> NativeFile:
return NativeFile(
name="MT32_CONTROL.ROM", destination="mt32/MT32_CONTROL.ROM", native_system=system,
truth={"name": "MT32_CONTROL.ROM", "path": "mt32/MT32_CONTROL.ROM", "md5": md5,
"crc32": md5[:8], "required": True, "_cores": [core]},
runners=[(False, core)],
)
def _added(self, exporter, systems) -> list[str]:
return [c["name"] for c in landed_changes(exporter, systems).records
if c["kind"] == "added"]
def test_recalbox_writes_both_md5_in_one_element(self):
systems = {"dos": NativeSystem("dos", files=[
self._addition(self.A, "dosbox_pure"), self._addition(self.B, "dosbox_core")])}
exporter = discover_exporters()["recalbox"]()
produced = exporter.render(systems, Report(), {})["es_bios.xml"]
elements = [e for e in ET.fromstring(produced).iter("bios")]
self.assertEqual(len(elements), 1)
self.assertEqual(elements[0].get("md5").split(","), [self.A, self.B])
self.assertEqual(elements[0].get("core"), "libretro/dosbox_pure,libretro/dosbox_core")
self.assertEqual(exporter.validate(systems, {"es_bios.xml": produced}), [])
self.assertEqual(len(self._added(exporter, systems)), 2)
def test_system_dat_counts_the_line_it_wrote(self):
systems = {"DOS": NativeSystem("DOS", files=[
self._addition(self.A, "dosbox_pure", "DOS"),
self._addition(self.B, "dosbox_core", "DOS")])}
exporter = discover_exporters()["retroarch"]()
original = 'clrmamepro (\n\tname "System"\n)\n\ngame (\n\tname "System"\n' \
'\tcomment "System"\n\n\tcomment "DOS"\n\trom ( name a.bin size 1 crc 00000000 )\n)\n'
produced = exporter.render(systems, Report(), {"System.dat": original})["System.dat"]
self.assertEqual(produced.count("MT32_CONTROL.ROM"), 1)
self.assertEqual(len(self._added(exporter, systems)), 1)
def test_retrodeck_counts_the_entry_it_appended(self):
theirs = NativeFile(
name="scph1001.bin", destination="scph1001.bin", native_system="psx",
platform={"name": "scph1001.bin", "md5": "1" * 32, "component": "duckstation"})
def addition(md5: str) -> NativeFile:
return NativeFile(
name="scph5501.bin", destination="scph5501.bin", native_system="psx",
truth={"name": "scph5501.bin", "md5": md5, "required": True,
"_cores": ["duckstation"]},
runners=[(True, "duckstation")])
systems = {"psx": NativeSystem("psx", files=[theirs, addition(self.A), addition(self.B)])}
manifest = json.dumps({"duckstation": {"name": "DuckStation", "bios": [
{"filename": "scph1001.bin", "md5": "1" * 32, "system": "psx"}]}})
exporter = discover_exporters()["retrodeck"]()
produced = exporter.render(systems, Report(), {"duckstation/component_manifest.json": manifest})
bios = json.loads(produced["duckstation/component_manifest.json"])["duckstation"]["bios"]
self.assertEqual([e["filename"] for e in bios], ["scph1001.bin", "scph5501.bin"])
self.assertEqual(self._added(exporter, systems), ["scph5501.bin"])
class AdditionOrder(unittest.TestCase):
"""What we add is listed the way the code looks for it."""
+2
View File
@@ -8,6 +8,8 @@ Galaksija ROM and a PS2 ROM2.BIN.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -9,6 +9,8 @@ have vanished with it.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import tempfile
import unittest
from pathlib import Path
+2
View File
@@ -8,6 +8,8 @@ homonym tests/test_game_data_homonyms.py forbids the resolver to serve.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import sys
import tempfile
+2
View File
@@ -8,6 +8,8 @@ directory, and only a manual reading found it.
"""
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import tempfile
import unittest
+2
View File
@@ -7,6 +7,8 @@ attached to misterfpga by substring and checked against the full list:
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import tempfile
+2
View File
@@ -6,6 +6,8 @@ today's upstream no longer carries, but the bytes are in the project's history.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import sys
import unittest
+2
View File
@@ -9,6 +9,8 @@ and put every file one directory too deep.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import unittest
from pathlib import Path
+2
View File
@@ -9,6 +9,8 @@ to upstream PCSX2.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import sys
+2
View File
@@ -9,6 +9,8 @@ served while data/bluemsx held the 8 KB one.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import shutil
+2
View File
@@ -8,6 +8,8 @@ the pack and the manifest while verify, comparing md5, called it OK.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import sys
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import subprocess
import sys
+2
View File
@@ -12,6 +12,8 @@ carries `unsourceable:` until its own bytes are held.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import os
import re
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import re
import sys
+2
View File
@@ -8,6 +8,8 @@ can lose its backing, then on the repository's own files.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import copy
import json
import sys
+2
View File
@@ -7,6 +7,8 @@ so a test pins the join and not the state of the data.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import shutil
import sys
+2
View File
@@ -7,6 +7,8 @@ it. RetroArch names Galaksija's 4 KiB galaksija/rom1.bin, so DOSBox's
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
+2
View File
@@ -10,6 +10,8 @@ the pad reaching the console, a compositor covering it) is not exercised.
"""
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import importlib.util
import json
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import tempfile
import unittest
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import shutil
import sys
import tempfile
+2
View File
@@ -9,6 +9,8 @@ ROCKNIX's higan SGB1.sfc/program.rom under the file SGB1.sfc.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import unittest
+2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import shutil
import sys
import tempfile
+2
View File
@@ -1,6 +1,8 @@
"""Tests for install.py platform detection and config parsing."""
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import functools
import hashlib
+2
View File
@@ -8,6 +8,8 @@ menu) is not exercised.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import io
import json
+2
View File
@@ -8,6 +8,8 @@ which cores keep each system, the rule a pack built for a target follows.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import io
import json
+2
View File
@@ -7,6 +7,8 @@ honours Retry-After, and large files that resume where they stopped.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import errno
import hashlib
+2
View File
@@ -11,6 +11,8 @@ never moved, and checked again once written.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import copy
import errno
+2
View File
@@ -8,6 +8,8 @@ index, published by scripts/generate_games_index.py.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import functools
import gzip
+2
View File
@@ -9,6 +9,8 @@ installs again from disk, --from-pack, every file checked by its hash.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import hashlib
import io
+2
View File
@@ -9,6 +9,8 @@ to one answer.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import contextlib
import functools
import hashlib
+2
View File
@@ -9,6 +9,8 @@ installs it).
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import argparse
import contextlib
import errno
+2
View File
@@ -7,6 +7,8 @@ platform outright.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import unittest
from scripts.scraper.targets import lakka_targets_scraper as lakka
+2
View File
@@ -8,6 +8,8 @@ that then replaced the cache entry.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import io
import json
+2
View File
@@ -16,6 +16,8 @@ Two checks read the committed data:
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import re
import unittest
from collections import defaultdict
+2
View File
@@ -8,6 +8,8 @@ and a fixed path the launcher passes (Batocera's x16emu shape).
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import hashlib
import inspect
import os
+2
View File
@@ -8,6 +8,8 @@ is checked against the revision itself.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import dataclasses
import json
import sys
+2
View File
@@ -8,6 +8,8 @@ fixture's own lines, and a construct that is gone must stop the scrape.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import textwrap
import unittest
+2
View File
@@ -8,6 +8,8 @@ is checked against the tag itself.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import json
import sys
import unittest
+2
View File
@@ -8,6 +8,8 @@ the fixture's own lines, and a construct that is gone must stop the scrape.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import textwrap
import unittest
+2
View File
@@ -8,6 +8,8 @@ cites. A construct that is gone or unknown must stop the scrape.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import textwrap
import unittest
+2
View File
@@ -8,6 +8,8 @@ cites. A construct that is gone or unknown must stop the scrape.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import dataclasses
import json
import sys
+2
View File
@@ -9,6 +9,8 @@ configs differ, and a construct that is gone must stop the scrape.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import textwrap
import unittest
+2
View File
@@ -9,6 +9,8 @@ Sys from system/dolphin-emu/Sys and keeps User in the save directory.
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import os
import sys
import unittest
Loaded 100 of 286 files, more files were not shown because too many files have changed in this diff. Show more