Skip to content

Commit 552ac5e

Browse files
committed
Tests(refactor): Mirror the engine-grid and demo tests under tests/scripts
Both cover `scripts/`, so they belong beside the other script tests rather than in the library's half of the `tests/` namespace. Their repository-root lookups count directories, and the counts move with them. One stale path travelled with them. The commit that moved the grid to `scripts/bench/engines.py` sits a branch below, but a later commit here adds a test that spawns the grid by path and was written against the old spelling, so it named a file that no longer exists. It ran `uv run scripts/bench_engines.py` and failed to spawn. That is the shape of this whole change: a path written down in one place and not the other. The mirrored layout is what makes the pairing checkable -- a test under `tests/scripts/bench/` has exactly one script it can be about.
1 parent 113a7b9 commit 552ac5e

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
def test_contract_scales_counts_across_sequential_sessions() -> None:
1515
"""An SxWxP scenario counts every session without adding concurrency."""
16-
root = pathlib.Path(__file__).parents[1]
16+
root = pathlib.Path(__file__).parents[3]
1717
env = os.environ.copy()
1818
env.pop("VIRTUAL_ENV", None)
1919

@@ -42,7 +42,7 @@ def test_contract_scales_counts_across_sequential_sessions() -> None:
4242
@pytest.mark.parametrize("scenario", ["0x1x1", "1x0x1", "1x1x0", "wat", "1x1x1x1"])
4343
def test_contract_rejects_invalid_scenarios_without_a_traceback(scenario: str) -> None:
4444
"""Invalid cardinality is a concise CLI usage error, not an internal crash."""
45-
root = pathlib.Path(__file__).parents[1]
45+
root = pathlib.Path(__file__).parents[3]
4646
env = os.environ.copy()
4747
env.pop("VIRTUAL_ENV", None)
4848

@@ -71,7 +71,7 @@ def test_matrix_executes_and_reports_a_multi_session_sample(
7171
tmp_path: pathlib.Path,
7272
) -> None:
7373
"""A live matrix sample builds S sessions serially and reports SxWxP totals."""
74-
root = pathlib.Path(__file__).parents[1]
74+
root = pathlib.Path(__file__).parents[3]
7575
output = tmp_path / "matrix.json"
7676
env = os.environ.copy()
7777
env.pop("VIRTUAL_ENV", None)
@@ -134,15 +134,15 @@ def test_matrix_executes_and_reports_a_multi_session_sample(
134134

135135
def test_sync_matrix_warms_every_session_before_topology_verification() -> None:
136136
"""A multi-session warmup validates only after building every session."""
137-
root = pathlib.Path(__file__).parents[1]
137+
root = pathlib.Path(__file__).parents[3]
138138
env = os.environ.copy()
139139
env.pop("VIRTUAL_ENV", None)
140140

141141
completed = subprocess.run(
142142
(
143143
"uv",
144144
"run",
145-
"scripts/bench_engines.py",
145+
"scripts/bench/engines.py",
146146
"matrix",
147147
"--shapes",
148148
"2x1x1",
@@ -171,7 +171,7 @@ def test_sync_matrix_warms_every_session_before_topology_verification() -> None:
171171
@pytest.mark.parametrize("mode", ["sync", "async"])
172172
def test_build_driver_rejects_a_failed_operation(mode: str) -> None:
173173
"""A partial plan failure cannot be recorded as a successful timing sample."""
174-
root = pathlib.Path(__file__).parents[1]
174+
root = pathlib.Path(__file__).parents[3]
175175
env = os.environ.copy()
176176
env.pop("VIRTUAL_ENV", None)
177177
source = textwrap.dedent(
@@ -243,7 +243,7 @@ async def run_batch(self, requests):
243243

244244
def test_live_topology_verifier_rejects_a_partial_build() -> None:
245245
"""A command-successful but incomplete tmux hierarchy is not a valid sample."""
246-
root = pathlib.Path(__file__).parents[1]
246+
root = pathlib.Path(__file__).parents[3]
247247
env = os.environ.copy()
248248
env.pop("VIRTUAL_ENV", None)
249249
source = textwrap.dedent(
@@ -274,7 +274,7 @@ def test_live_topology_verifier_rejects_a_partial_build() -> None:
274274

275275
def test_benchmark_server_uses_an_empty_tmux_config() -> None:
276276
"""A benchmark daemon cannot inherit geometry or options from user config."""
277-
root = pathlib.Path(__file__).parents[1]
277+
root = pathlib.Path(__file__).parents[3]
278278
env = os.environ.copy()
279279
env.pop("VIRTUAL_ENV", None)
280280
source = textwrap.dedent(
@@ -310,7 +310,7 @@ def test_benchmark_server_uses_an_empty_tmux_config() -> None:
310310
)
311311
def test_matrix_rejects_unknown_axis_values(option: str, value: str) -> None:
312312
"""A misspelled matrix axis cannot silently shrink the benchmark grid."""
313-
root = pathlib.Path(__file__).parents[1]
313+
root = pathlib.Path(__file__).parents[3]
314314
env = os.environ.copy()
315315
env.pop("VIRTUAL_ENV", None)
316316

@@ -344,7 +344,7 @@ def test_matrix_rejects_unknown_axis_values(option: str, value: str) -> None:
344344

345345
def test_cleanup_failure_is_rejected() -> None:
346346
"""A failed session cleanup cannot contaminate later timing samples."""
347-
root = pathlib.Path(__file__).parents[1]
347+
root = pathlib.Path(__file__).parents[3]
348348
env = os.environ.copy()
349349
env.pop("VIRTUAL_ENV", None)
350350
source = textwrap.dedent(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _run_demo(
3333
*args: str,
3434
) -> tuple[subprocess.CompletedProcess[str], dict[str, t.Any]]:
3535
"""Run the real CLI in an isolated temporary directory and read its report."""
36-
root = pathlib.Path(__file__).parents[1]
36+
root = pathlib.Path(__file__).parents[2]
3737
output = tmp_path / f"report-{len(list(tmp_path.glob('report-*.json')))}.json"
3838
env = os.environ.copy()
3939
env.pop("VIRTUAL_ENV", None)

0 commit comments

Comments
 (0)