test_workspace_perf.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
11 hours ago
| 1 | """Performance tests for workspace check-next (§MR.10 performance).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import time |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from tools.workspace.check_next import check_next |
| 9 | from tools.workspace.manifest import load_manifest_file |
| 10 | from tests.fixtures.workspace import build_two_repo_constellation |
| 11 | |
| 12 | |
| 13 | def test_check_next_five_member_under_two_seconds(tmp_path: Path) -> None: |
| 14 | fx = build_two_repo_constellation(tmp_path, with_musehub=True, with_brain=True) |
| 15 | # Add two more optional absent members via manifest edit |
| 16 | import yaml |
| 17 | |
| 18 | data = yaml.safe_load(fx["manifest"].read_text(encoding="utf-8")) |
| 19 | data["members"].extend( |
| 20 | [ |
| 21 | { |
| 22 | "id": "edge2", |
| 23 | "role": "edge", |
| 24 | "root": "${EDGE2_ROOT}", |
| 25 | "regime": None, |
| 26 | "required": False, |
| 27 | "relay": False, |
| 28 | }, |
| 29 | { |
| 30 | "id": "kit", |
| 31 | "role": "kit", |
| 32 | "root": "${KIT_ROOT}", |
| 33 | "regime": None, |
| 34 | "required": False, |
| 35 | "relay": False, |
| 36 | }, |
| 37 | ] |
| 38 | ) |
| 39 | fx["manifest"].write_text(yaml.safe_dump(data), encoding="utf-8") |
| 40 | manifest = load_manifest_file(fx["manifest"], manifest_source="local_workspace") |
| 41 | start = time.perf_counter() |
| 42 | result = check_next(manifest) |
| 43 | elapsed = time.perf_counter() - start |
| 44 | assert result.exit_code == 0 |
| 45 | assert elapsed < 2.0 |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
11 hours ago