|
11 | 11 | from types import SimpleNamespace |
12 | 12 |
|
13 | 13 | import polars as pl |
| 14 | +import pytest |
14 | 15 |
|
15 | 16 |
|
16 | 17 | def _load_runner(): |
@@ -61,6 +62,33 @@ def _load_benchmark(): |
61 | 62 | return module |
62 | 63 |
|
63 | 64 |
|
| 65 | +@pytest.mark.skipif(sys.platform != "linux", reason="Publication timings identify a Linux host") |
| 66 | +def test_benchmark_report_accepts_linux_with_blank_processor_query(monkeypatch) -> None: |
| 67 | + benchmark = _load_benchmark() |
| 68 | + validation = Path(__file__).parents[2] / "validation" |
| 69 | + correctness = json.loads((validation / "REAL_STRATEGY_RESULTS.json").read_text()) |
| 70 | + measurements = json.loads((validation / "REAL_STRATEGY_PERFORMANCE.json").read_text()) |
| 71 | + retained = { |
| 72 | + (record["case_study"], record["framework"]): record for record in measurements["records"] |
| 73 | + } |
| 74 | + |
| 75 | + def measured_side(*, case_study, framework, side, **_settings): |
| 76 | + key = "framework_engine" if side == "framework" else "ml4t_engine" |
| 77 | + return copy.deepcopy(retained[(case_study, framework)][key]) |
| 78 | + |
| 79 | + # Reuse real measured samples to isolate report production from native engine runtimes. |
| 80 | + monkeypatch.setattr(benchmark, "_measure_side", measured_side) |
| 81 | + monkeypatch.setattr(benchmark.platform, "processor", lambda: "") |
| 82 | + report = benchmark.build_report( |
| 83 | + correctness=correctness, |
| 84 | + bundle_root=validation, |
| 85 | + warmups=1, |
| 86 | + samples=10, |
| 87 | + ) |
| 88 | + |
| 89 | + assert benchmark.report_failures(report, correctness) == [] |
| 90 | + |
| 91 | + |
64 | 92 | class _Broker: |
65 | 93 | def __init__(self) -> None: |
66 | 94 | self.cash = 1_000.0 |
|
0 commit comments