mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 04:48:54 -06:00
refactor: commands read the repository root
This commit is contained in:
1 parent
39e10db75c
commit
9ac3145c5e
13 files changed
+102
-103
No files matched your search
@@ -424,7 +424,7 @@ class CommittedIndex(unittest.TestCase):
|
||||
f"source_commit: {'b' * 40}\ncore_version: '0.2'\n")
|
||||
(root / "games" / "arcade" / "core.json").write_text(json.dumps(
|
||||
{"profile": "core", "core_version": "0.1", "source": {"commit": COMMIT}}))
|
||||
with mock.patch.object(validate_schemas, "ROOT", root):
|
||||
with mock.patch.object(validate_schemas, "REPO_ROOT", root):
|
||||
(error,) = validate_schemas._arcade_pin_errors()
|
||||
self.assertIn("read at aaaaaaaaaaaa", error)
|
||||
self.assertIn("core_version '0.1'", error)
|
||||
|
||||
@@ -6062,7 +6062,7 @@ class AProfilePathIsTheEmulatorsNotOurs(unittest.TestCase):
|
||||
"emulator: X\nfiles:\n - name: scph1001.bin\n"
|
||||
" path: .variants/scph1001.bin.abc12345\n"
|
||||
)
|
||||
with mock.patch.object(validate_schemas, "ROOT", Path(directory)):
|
||||
with mock.patch.object(validate_schemas, "REPO_ROOT", Path(directory)):
|
||||
errors = validate_schemas._repository_layout_in_profiles()
|
||||
self.assertEqual(len(errors), 1)
|
||||
self.assertIn(".variants/", errors[0])
|
||||
|
||||
@@ -45,7 +45,7 @@ class EachSourceIsParsedOnce(unittest.TestCase):
|
||||
"emulator: Core\nfiles:\n- name: a.bin\n path: .variants/a.bin\n")
|
||||
loaded = []
|
||||
real = validate_schemas.yaml_load
|
||||
with mock.patch.object(validate_schemas, "ROOT", root), \
|
||||
with mock.patch.object(validate_schemas, "REPO_ROOT", root), \
|
||||
mock.patch.object(validate_schemas, "yaml_load",
|
||||
side_effect=lambda h: loaded.append(h.name) or real(h)):
|
||||
validate_schemas._validate_yaml_directory(root / "emulators", "emulator.schema.json")
|
||||
|
||||
+3
-2
@@ -6996,9 +6996,10 @@ class OneOfASearchList(unittest.TestCase):
|
||||
|
||||
@unittest.skipUnless(HAS_JSONSCHEMA, "validate_schemas needs jsonschema")
|
||||
def test_schema_refuses_a_set_split_on_required(self):
|
||||
from validate_schemas import _group_requirement_split, ROOT
|
||||
from validate_schemas import _group_requirement_split
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
path = ROOT / "emulators" / "seq.yml"
|
||||
path = REPO_ROOT / "emulators" / "seq.yml"
|
||||
own_value = {"groups": {"g": {"required": True}},
|
||||
"files": [{"name": "a", "group": "g", "required": False},
|
||||
{"name": "b", "group": "g"}]}
|
||||
|
||||
@@ -602,7 +602,7 @@ class ExpertRuns(Lists):
|
||||
json.dumps({**LIST, "truth_files": None}), encoding="utf-8")
|
||||
path = Path(root) / "install" / "standalone" / "retroarch.json"
|
||||
path.write_text(json.dumps(LAYOUTS), encoding="utf-8")
|
||||
with mock.patch.object(validate_schemas, "ROOT", Path(root)):
|
||||
with mock.patch.object(validate_schemas, "REPO_ROOT", Path(root)):
|
||||
self.assertEqual(validate_schemas._semantic_standalone_checks(path, LAYOUTS),
|
||||
[])
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class SemanticManifestValidation(unittest.TestCase):
|
||||
)
|
||||
|
||||
output = io.StringIO()
|
||||
with mock.patch.object(validate_schemas, "ROOT", root), mock.patch.object(
|
||||
with mock.patch.object(validate_schemas, "REPO_ROOT", root), mock.patch.object(
|
||||
sys, "argv", ["validate_schemas.py"]
|
||||
), redirect_stdout(output):
|
||||
result = validate_schemas.main()
|
||||
|
||||
Reference in new issue
Block a user