mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-21 03:09:08 -05:00
fix: make the report directory before writing it
A platform with nothing left to correct writes no file, so its output directory was never made: RetroPie's report then raised FileNotFoundError into a fresh --output-dir and stopped --all.
This commit is contained in:
1 parent
d92291684c
commit
95476afb28
2 files changed
+11
No files matched your search
@@ -668,7 +668,10 @@ def write_report(path: Path, report: dict) -> None:
|
||||
|
||||
The run prints five examples per kind of change. The page lists them
|
||||
all, so the maintainer reading it finds each line of the diff named.
|
||||
A platform with nothing to write made no directory of its own: the
|
||||
output directory itself may not exist yet.
|
||||
"""
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
write_if_changed(str(path), json.dumps(report, indent=2) + "\n")
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,14 @@ class ExportReportIsWrittenAndRead(unittest.TestCase):
|
||||
(Path(scratch) / "recalbox").mkdir()
|
||||
self.assertEqual(load_export_reports(scratch), [report])
|
||||
|
||||
def test_a_report_goes_into_a_directory_not_yet_made(self):
|
||||
"""RetroPie with nothing left to correct writes no file, so its
|
||||
output directory was never made and the report crashed --all."""
|
||||
with tempfile.TemporaryDirectory(dir=ROOT / "tmp") as scratch:
|
||||
target = Path(scratch) / "fresh" / "retropie.json"
|
||||
export_native.write_report(target, _report("retropie", []))
|
||||
self.assertTrue(target.exists())
|
||||
|
||||
def test_export_keeps_every_change_not_the_printed_five(self):
|
||||
source = (ROOT / "scripts" / "export_native.py").read_text(encoding="utf-8")
|
||||
body = source[source.index("def export_platform("):source.index("def write_report(")]
|
||||
|
||||
Reference in new issue
Block a user