Skip to content

Commit ab236f9

Browse files
Fix PR-E1 INV-3 gate fixture scope mismatch (smoke triage)
The Mac smoke run reported INV-3 gate fixture scope mismatch: session_verifier_pair was @pytest.fixture(scope="module") but depended on fresh_verifier_factory which is function-scoped in tests/conftest.py. Pytest forbids module-scoped fixtures from depending on function-scoped ones \u2014 raises ScopeMismatch. Inlined the verifier build inside session_verifier_pair so the module scope is self-contained. No fixture dependency on the function-scoped factory. Behavior identical: same VerifierConfig (sink=4, window=64, bf16, CPU), same shared-pair pattern across the 3 tests in this file. Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
1 parent ae0947c commit ab236f9

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

tests/integration/test_inv3_session_determinism_gate.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,35 @@
4747

4848

4949
@pytest.fixture(scope="module")
50-
def session_verifier_pair(fresh_verifier_factory):
50+
def session_verifier_pair():
5151
"""Two independent verifiers + stores + coordinator pairs.
5252
5353
Module-scoped: loading Qwen3-0.6B twice costs ~2-4 s on Mac M4
5454
with a warm HF cache. Tests share the pair; each test resets
5555
each verifier's state via ``reset()`` before driving its own
5656
workload, so cross-test bleed-over is impossible by construction.
57+
58+
Inline-build the verifier (rather than going through
59+
``fresh_verifier_factory`` which is function-scoped in
60+
``tests/conftest.py``) so the module scope is consistent —
61+
pytest forbids a module-scoped fixture depending on a function-
62+
scoped one.
5763
"""
58-
fv_a = fresh_verifier_factory(sink=4, window=64)
59-
fv_b = fresh_verifier_factory(sink=4, window=64)
64+
import torch
65+
from kv_cache_proposer.verifier import SinkWindowVerifier, VerifierConfig
66+
67+
def _build(sink: int, window: int) -> SinkWindowVerifier:
68+
return SinkWindowVerifier(
69+
VerifierConfig(
70+
dtype=torch.bfloat16,
71+
device="cpu",
72+
sink_size=sink,
73+
window_size=window,
74+
)
75+
)
76+
77+
fv_a = _build(sink=4, window=64)
78+
fv_b = _build(sink=4, window=64)
6079
yield fv_a, fv_b
6180

6281

0 commit comments

Comments
 (0)