mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: stop coverage on a missing input directory
This commit is contained in:
1 parent
cb17145665
commit
96f100ac22
2 files changed
+20
No files matched your search
@@ -20,6 +20,7 @@ from pathlib import Path
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from common import (
|
||||
InputMissing,
|
||||
compute_composition,
|
||||
count_catalog_matched,
|
||||
declared_root,
|
||||
@@ -211,6 +212,10 @@ def platform_coverages(
|
||||
coverages[name] = compute_coverage(
|
||||
name, platforms_dir, db, data_registry, emulators_dir=emulators_dir,
|
||||
)
|
||||
except InputMissing:
|
||||
# A missing profile or platform directory is no platform
|
||||
# left out: it emptied every one and cached the result.
|
||||
raise
|
||||
except FileNotFoundError as exc:
|
||||
print(f" {name}: skipped ({exc})", file=sys.stderr)
|
||||
COVERAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -95,6 +95,21 @@ class CoverageCache(unittest.TestCase):
|
||||
self._run()
|
||||
self.assertEqual(len(list((self.work / "cache").glob("*.pickle"))), 1)
|
||||
|
||||
def test_a_missing_input_directory_stops_the_run(self):
|
||||
"""A missing --emulators-dir skipped every platform as if it had no
|
||||
YAML, then replaced the cache with the empty result."""
|
||||
self._run()
|
||||
kept = sorted((self.work / "cache").glob("*.pickle"))
|
||||
|
||||
def missing(*_args, **_kwargs):
|
||||
raise generate_readme.InputMissing("no emulator profile directory at nosuch")
|
||||
|
||||
with mock.patch.object(generate_readme, "compute_coverage", missing), \
|
||||
mock.patch.object(generate_readme, "_coverage_inputs", return_value="other"), \
|
||||
self.assertRaises(generate_readme.InputMissing):
|
||||
self._run()
|
||||
self.assertEqual(sorted((self.work / "cache").glob("*.pickle")), kept)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user