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