MCPcopy Create free account
hub / github.com/LineageOS/hudson / HudsonTestCase

Class HudsonTestCase

test.py:7–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7class HudsonTestCase(unittest.TestCase):
8 def test_build_targets(self):
9 models_json = set()
10
11 with open("updater/devices.json", "r") as f:
12 for device in json.load(f):
13 self.assertFalse(
14 device["model"] in models_json,
15 f"Duplicate model in devices.json: {device['model']}",
16 )
17 models_json.add(device["model"])
18
19 models_hudson = set()
20
21 with open("lineage-build-targets", "r") as f:
22 for line in f.readlines():
23 line = line.strip()
24
25 if not line or line.startswith("#"):
26 continue
27
28 model, _, _, _ = line.split()
29
30 self.assertFalse(
31 model in models_hudson,
32 f"Duplicate model in lineage-build-targets: {model}",
33 )
34 models_hudson.add(model)
35
36 models_missing = models_hudson - models_json
37
38 if models_missing:
39 self.fail(f"Missing models in devices.json: {', '.join(models_missing)}")
40
41 def test_json(self):
42 for file in glob.glob("updater/*.json"):
43 with open(file, "r") as f:
44 try:
45 json.load(f)
46 except json.JSONDecodeError as e:
47 self.fail(f"Failed to load {file}")
48
49
50if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected