mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: fail the fileless check on real errors
This commit is contained in:
1 parent
1d00516d96
commit
db26a1276e
1 file changed
+15
-6
@@ -12,6 +12,7 @@ import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
@@ -110,20 +111,28 @@ class TestCorpusIsAnswered(unittest.TestCase):
|
||||
self.skipTest("no upstream cache")
|
||||
from safeparse import yaml_load
|
||||
|
||||
fetch = fileless_audit.upstream.fetch_file
|
||||
read = []
|
||||
|
||||
def counted(*args, **kwargs):
|
||||
lines = fetch(*args, **kwargs)
|
||||
if lines is not None:
|
||||
read.append(args[2])
|
||||
return lines
|
||||
|
||||
flagged = []
|
||||
with mock.patch.object(fileless_audit.upstream, "fetch_file", counted):
|
||||
for path in sorted((ROOT / "emulators").glob("*.yml")):
|
||||
with path.open(encoding="utf-8") as handle:
|
||||
document = yaml_load(handle) or {}
|
||||
if document.get("files"):
|
||||
continue
|
||||
try:
|
||||
hits = fileless_audit.audit(
|
||||
if fileless_audit.audit(
|
||||
path.stem, str(ROOT / "emulators"), str(ROOT / ".cache"), True
|
||||
)
|
||||
except Exception:
|
||||
continue
|
||||
if hits:
|
||||
):
|
||||
flagged.append(path.stem)
|
||||
if not read:
|
||||
self.skipTest("the upstream cache holds no source a fileless profile cites")
|
||||
self.assertEqual(
|
||||
flagged, [],
|
||||
"these declare no files and their source asks for a directory, "
|
||||
|
||||
Reference in new issue
Block a user