Skip to content

Commit f4b3274

Browse files
RobTandclaude
andcommitted
tests: the moe_mixed import guard must locate the module, not the repo
The 0.8.10 release train failed in 'verify installed wheel': the new guard test opened gridbook/moe_mixed.py at a path relative to the test file, which exists in a checkout but not in the release job's layout (tests copied to a temp cwd, gridbook imported from the installed wheel). Resolve the source via importlib.util.find_spec("gridbook.moe_mixed").origin instead — identical in-repo, correct against any installed layout. Verified both ways: 73 passed in-repo; the guard passes from a foreign cwd with only the package on the path. Nothing was published from the failed train (publish + GitHub release were skipped), so the v0.8.10 tag is re-cut on this commit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TZbSLixmqwxwbSV6v1MApK
1 parent ab9aa66 commit f4b3274

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
runner; the file now skips only for a missing vLLM and fails loudly on
1414
gridbook's own import errors, and a CPU-suite guard statically parses
1515
`moe_mixed`'s imports from `moe_gemv_select` and holds them against the
16-
real module.
16+
real module (resolved through `importlib.util.find_spec`, so the guard also
17+
runs in the release train's installed-wheel layout, where the repo tree is
18+
not at a path relative to the test file).
1719
- The mixed method's FP8-v2 dispatch gate is tri-state-correct: `require`
1820
keeps the exact fail-load A/B-arm refusal on mixed FP8 groups, `auto` (the
1921
unset default) keeps the inherited kernel for them with the reason

tests/test_cb_gemv_select.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,17 @@ def test_moe_mixed_imports_only_names_moe_gemv_select_defines():
440440
symbol. Parse the import statically and hold it against the real module,
441441
no vLLM needed."""
442442
import ast
443+
import importlib.util
443444
from pathlib import Path
444445

445446
import gridbook.moe_gemv_select as sel
446447

447-
src = Path(__file__).resolve().parents[1] / "gridbook" / "moe_mixed.py"
448-
tree = ast.parse(src.read_text())
448+
# Resolve the source through the import system, not the repo layout:
449+
# the release train runs this suite against the installed wheel from a
450+
# temp cwd where ../gridbook/moe_mixed.py does not exist.
451+
spec = importlib.util.find_spec("gridbook.moe_mixed")
452+
assert spec is not None and spec.origin, "gridbook.moe_mixed has no locatable source"
453+
tree = ast.parse(Path(spec.origin).read_text())
449454
names = [
450455
alias.name
451456
for node in ast.walk(tree)

0 commit comments

Comments
 (0)