| 114 | |
| 115 | |
| 116 | def module_order(errors: list[str]) -> list[str]: |
| 117 | result = [] |
| 118 | seen = set() |
| 119 | mods = [] |
| 120 | for e in errors: |
| 121 | if ":" not in e: |
| 122 | dump_original_errors(errors) |
| 123 | pytest.fail(f"Only module scoped errors are supported, got {e}") |
| 124 | mod, _ = e.split(":", maxsplit=1) |
| 125 | mods.append(mod) |
| 126 | for i, mod in enumerate(mods): |
| 127 | if i > 0: |
| 128 | if mod != mods[i - 1] and mod in seen: |
| 129 | dump_original_errors(errors) |
| 130 | pytest.fail(f"Each module must form a single block, {mod} appears split") |
| 131 | if mod not in seen: |
| 132 | result.append(mod) |
| 133 | seen.add(mod) |
| 134 | return result |
| 135 | |
| 136 | |
| 137 | def match_module_order(actual: list[str], expected_order: list[str]) -> list[str]: |