(stderr, ids)
| 201 | |
| 202 | |
| 203 | def 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 | |
| 222 | def validate_events(case_name, events): |
no test coverage detected