Skip to content

Commit ae9cecf

Browse files
FonaTechclaude
andcommitted
Make the lazy-probe sweep test independent of installed backends
On Linux CI MLX is absent, so resolve_backend("mlx") falls back to cpu and the MLX variants dedupe into the CPU set. The test now resolves backends as requested, and checks the fallback collapse separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent de46962 commit ae9cecf

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎tests/test_lazy_probe.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
)
1717

1818

19-
def test_sweep_axes_collapse_per_backend_and_dedupe_by_resolved_layout():
19+
def test_sweep_axes_collapse_per_backend_and_dedupe_by_resolved_layout(monkeypatch):
20+
# Backends resolve as requested here, so the test does not depend on MLX being installed (Linux CI).
21+
from chronos.workbench import lazy_probe
22+
monkeypatch.setattr(lazy_probe, "resolve_backend", lambda b: b)
2023
sweep = ProbeSweep.from_dict({"backends": ["cpu", "mlx"], "paging": ["auto", "cluster", "expert"],
2124
"residency": ["planned", "window"], "ram_ratios": [0.5],
2225
"miss_policies": ["sync_on_demand"], "speculative": [False, True],
@@ -35,6 +38,10 @@ def test_sweep_axes_collapse_per_backend_and_dedupe_by_resolved_layout():
3538
lambda p: p)
3639
assert len(capped) == 3 and total > 3
3740
assert variant_label(mlx_v[0]).startswith("mlx/cluster/r0.5/planned/d0.7/w12ms")
41+
# A backend this machine lacks resolves to one it has; duplicates then collapse into one set.
42+
monkeypatch.setattr(lazy_probe, "resolve_backend", lambda b: "cpu")
43+
fallback, _ = expand_variants(sweep, lambda p: "cluster" if p == "auto" else p)
44+
assert {v["backend"] for v in fallback} == {"cpu"} and len(fallback) == len(torch_v)
3845

3946

4047
@pytest.mark.parametrize("bad", [dict(paging=["louvain"]), dict(residency=["queue"]), dict(ram_ratios=[0]),

0 commit comments

Comments
 (0)