(evidence, tool, registry, selected, environment, root)
| 486 | |
| 487 | |
| 488 | def _observations(evidence, tool, registry, selected, environment, root): |
| 489 | observations = [] |
| 490 | for index, path in enumerate(evidence.inventory()): |
| 491 | relative = os.path.relpath(path, os.path.join(evidence.path, "raw")) |
| 492 | parts = relative.split(os.sep) |
| 493 | if len(parts) != 2 or parts[0] not in selected: |
| 494 | evidence.uncertainty.append({"path": path, "reason": "unknown_profile_destination"}) |
| 495 | _error("input", "raw profile destination is outside requested scope") |
| 496 | suite, name = parts |
| 497 | marker = MARKER.fullmatch(name) |
| 498 | setup = SETUP.fullmatch(name) |
| 499 | profile = PROFILE.fullmatch(name) |
| 500 | if setup: |
| 501 | test = "*" |
| 502 | role = ObservationRole.CHILD if name.startswith("_setup.child.") else ObservationRole.SETUP |
| 503 | elif marker: |
| 504 | test = "*" if marker.group(1) == "_setup.child" else marker.group(1) |
| 505 | role = ObservationRole.CHILD |
| 506 | elif profile: |
| 507 | test = profile.group(1) |
| 508 | role = ObservationRole.PARENT if profile.group(2) == "parent" else ObservationRole.CHILD |
| 509 | else: |
| 510 | evidence.uncertainty.append({"path": path, "reason": "unaccounted_raw_entry"}) |
| 511 | _error("input", "unaccounted raw profile entry") |
| 512 | if test != "*" and test not in registry[suite]: |
| 513 | evidence.uncertainty.append({"path": path, "reason": "unknown_test_identity"}) |
| 514 | _error("input", "raw test identifier is outside expected registry") |
| 515 | if marker: |
| 516 | evidence.uncertainty.append({"path": path, "reason": "unaccounted_fork"}) |
| 517 | text = None |
| 518 | else: |
| 519 | text = _convert(evidence, tool, path, "profile-%06d" % index, |
| 520 | environment, root, unavailable=True) |
| 521 | observations.append(ProfileObservation(suite.encode("utf-8"), test.encode("utf-8"), |
| 522 | name.encode("utf-8"), role, text)) |
| 523 | return tuple(observations) |
| 524 | |
| 525 | |
| 526 | def collect(args): |
no test coverage detected