MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_events

Function parse_events

tests/test_coverage_children.py:203–219  ·  view source on GitHub ↗
(stderr, ids)

Source from the content-addressed store, hash-verified

201
202
203def parse_events(stderr, ids):
204 events = {name: [] for name in ids}
205 for line in stderr.splitlines():
206 if not line.startswith("COV_CHILD "):
207 continue
208 try:
209 item = json.loads(line[len("COV_CHILD "):])
210 except ValueError as exc:
211 raise Infrastructure("invalid fixture event") from exc
212 if (not isinstance(item, dict) or set(item) != {"id", "pid", "stage", "marker", "code"}
213 or not isinstance(item["id"], str) or item["id"] not in events
214 or type(item["pid"]) is not int or item["pid"] <= 0
215 or type(item["marker"]) is not int or item["marker"] not in (-1, 0, 1)
216 or type(item["code"]) is not int or not isinstance(item["stage"], str)):
217 raise Infrastructure("invalid fixture event fields")
218 events[item["id"]].append(item)
219 return events
220
221
222def validate_events(case_name, events):

Callers 1

run_caseFunction · 0.85

Calls 3

setFunction · 0.85
InfrastructureClass · 0.70
typeFunction · 0.50

Tested by

no test coverage detected