refactor: move review files and report to resolve

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 14:59:21 +01:00
1 parent 2a49bf237b
commit 9cb1e613b0
8 files changed
+179 -170

No files matched your search

+1 -7
View File
@@ -34,17 +34,11 @@ COMMANDS = {
"slots.py": (
"packs/slots.py", "resolve/collisions.py", "packs/slotscan.py", "packs/slotreport.py",
),
"validate_pr.py": ("resolve/review.py", "core/gitclone.py"),
"validate_pr.py": ("resolve/review.py", "resolve/reviewfiles.py", "resolve/reviewreport.py", "core/gitclone.py"),
"mame_ref_audit.py": ("profiling/mamerefs.py",),
"fileless_audit.py": ("profiling/fileless.py",),
"bundled_only.py": ("packs/bundledonly.py",),
"export_native.py": ("exporter/runner.py", "exporter/native.py", "exporter/originals.py", "exporter/landed.py"),
"mame_ref_audit.py": ("profiling/mamerefs.py",),
"fileless_audit.py": ("profiling/fileless.py",),
"bundled_only.py": ("packs/bundledonly.py",),
"mame_ref_audit.py": ("profiling/mamerefs.py",),
"fileless_audit.py": ("profiling/fileless.py",),
"mame_ref_audit.py": ("profiling/mamerefs.py",),
"refresh_data_dirs.py": ("packs/datadirs.py",),
"split_pack.py": ("packs/parts.py",),
"dedup.py": ("model/nodedup.py",),
+3 -4
View File
@@ -34,10 +34,9 @@ SIBLING_IMPORTS: dict[str, frozenset[str]] = {
# A campaign commits its findings the way the unattended jobs commit, and a
# standalone probe lists an emulator's releases through the one GitHub reader.
"probes": frozenset({"unattended", "scraper"}),
# A pass that wrote profiles rebuilds the site's record of cited source paths.
"profiling": frozenset({"sitegen"}),
# The MAME ref audit reads machine declarations as the MAME scraper parses them.
"profiling": frozenset({"scraper"}),
# A pass that wrote profiles rebuilds the site's record of cited source paths,
# and the MAME ref audit reads machine declarations as the MAME scraper parses them.
"profiling": frozenset({"sitegen", "scraper"}),
"romrecipes": frozenset(),
# The site prints the recipe counts and the dump-catalog coverage report
# those two packages compute, serves the handheld launchers and prints the
+9 -9
View File
@@ -56,7 +56,7 @@ class GitThatCannotAnswer(unittest.TestCase):
proc = subprocess.run(
[sys.executable, "-c", (
f"import sys; sys.path.insert(0, {str(REPO_ROOT / 'scripts')!r}); "
"import validate_pr; print(validate_pr.get_changed_files())"
"from resolve import reviewfiles; print(reviewfiles.get_changed_files())"
)],
cwd=tmp, capture_output=True, text=True, timeout=60, check=False,
)
@@ -86,14 +86,14 @@ class AProjectMainThatCannotBeFetched(unittest.TestCase):
cli.run_cli(worktree.project_base)
self.assertEqual(ended.exception.code, 1)
self.assertEqual(err.getvalue(), "ERROR: no main\n")
import validate_pr
from resolve import reviewfiles
with self.assertRaises(RuntimeError):
validate_pr.get_changed_files()
reviewfiles.get_changed_files()
def test_both_tools_compare_against_the_same_line(self):
import validate_pr
from core import gitclone
from profiling import worktree
from resolve import reviewfiles
diffs: list[tuple[str, ...]] = []
@@ -105,9 +105,9 @@ class AProjectMainThatCannotBeFetched(unittest.TestCase):
with mock.patch.object(gitclone, "project_main_line", return_value=None), \
mock.patch.object(gitclone, "git_lines", side_effect=lines), \
mock.patch.object(validate_pr, "git_lines", side_effect=lines):
mock.patch.object(reviewfiles, "git_lines", side_effect=lines):
self.assertEqual(worktree.project_base(), "origin/main")
validate_pr.get_changed_files()
reviewfiles.get_changed_files()
self.assertIn(("diff", "--name-only", "origin/main...HEAD"), diffs)
@@ -128,7 +128,7 @@ class ChangesNotYetCommittedAreRead(unittest.TestCase):
proc = subprocess.run(
[sys.executable, "-c", (
f"import sys; sys.path.insert(0, {str(REPO_ROOT / 'scripts')!r}); "
"import validate_pr; print(validate_pr.get_changed_files())"
"from resolve import reviewfiles; print(reviewfiles.get_changed_files())"
)],
cwd=tmp, capture_output=True, text=True, timeout=60, check=False,
)
@@ -151,9 +151,9 @@ class AForkPushedToItsOwnMain(unittest.TestCase):
return subprocess.run(
[sys.executable, "-c", (
f"import sys; sys.path.insert(0, {str(REPO_ROOT / 'scripts')!r}); "
"import validate_pr; from core import gitclone; "
"from resolve import reviewfiles; from core import gitclone; "
f"gitclone.PROJECT_URLS = ({project!r},); "
"print(validate_pr.get_changed_files())"
"print(reviewfiles.get_changed_files())"
)],
cwd=clone, capture_output=True, text=True, timeout=60, check=False,
)
+4 -4
View File
@@ -16,7 +16,7 @@ import tempfile
import unittest
from pathlib import Path
import validate_pr
from resolve import reviewfiles
from resolve import review
REPO_ROOT = Path(__file__).resolve().parent.parent
@@ -61,7 +61,7 @@ class FileShapeChecks(_Fixture):
self._bios_file("card/bios/sub/b.bin")
(self.tmp / "empty").mkdir()
self.assertEqual(
validate_pr.expand_folders(["card", "empty", "loose.bin"]),
reviewfiles.expand_folders(["card", "empty", "loose.bin"]),
[str(Path("card/bios/a.bin")), str(Path("card/bios/sub/b.bin")), "empty", "loose.bin"],
)
result = review.validate_file("empty", None, EMPTY_HASHES)
@@ -174,10 +174,10 @@ class AFileOnlyACoreReadsIsKnown(_Fixture):
# Copied under the declared name, never over a file, and only once.
card = self._bios_file("card/B.BIN", missing)
named = review.validate_file(card, db, EMPTY_HASHES, known)
self.assertEqual(validate_pr.place([named]), [named.destination])
self.assertEqual(reviewfiles.place([named]), [named.destination])
self.assertEqual((self.tmp / named.destination).read_bytes(), missing)
self.assertTrue((self.tmp / card).is_file())
self.assertEqual(validate_pr.place([named]), [])
self.assertEqual(reviewfiles.place([named]), [])
unknown = review.validate_file(self._bios_file("card/x.bin"), db, EMPTY_HASHES, known)
self.assertEqual((unknown.outcome, unknown.destination), ("unknown", ""))
placed = review.validate_file(
+2 -2
View File
@@ -20,7 +20,7 @@ from pathlib import Path
import yaml
import validate_pr
from resolve import reviewfiles
from core import gitclone
from resolve import review
@@ -209,7 +209,7 @@ class AnUnfetchedUpstreamIsFetched(unittest.TestCase):
os.chdir(clone)
try:
with mock.patch.object(gitclone, "PROJECT_URLS", (str(project),)):
self.assertEqual(validate_pr.get_changed_files(), ["bios/new.bin"])
self.assertEqual(reviewfiles.get_changed_files(), ["bios/new.bin"])
finally:
os.chdir(cwd)