mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-06 17:49:07 -05:00
[PR #1419] [MERGED] fix(tests): make mlsysim.core importable from CI without pip install #6538
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1419
Author: @profvjreddi
Created: 4/20/2026
Status: ✅ Merged
Merged: 4/20/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/test-units-mlsysim-path📝 Commits (1)
7022d88fix(tests): make mlsysim.core importable from CI without pip install📊 Changes
1 file changed (+15 additions, -4 deletions)
View changed files
📝
book/tests/test_units.py(+15 -4)📄 Description
Summary
Fixes the
book-mlsys-test-unitspre-commit hook, which has been red onevery
book-validate-devrun since 2026-04-18 (last green: 2026-04-17, sha532eed35).The fix is one line of corrected
sys.pathmath, with a comment explaining the layouttrap so it doesn't recur.
Why it failed
book/tests/test_units.pydid:But
mlsysimpackage layout is two levels deep:mlsysimispip install -e'd, so Python found it via site-packages.The path hack was inert. The import worked. Tests passed locally.
<repo_root>/mlsysim/(no__init__.py)as an implicit namespace package, and
mlsysim.coreresolved nowhere →ModuleNotFoundError.Fix
Point
sys.pathat<repo_root>/mlsysim/(the directory containing the package),not
<repo_root>/:Comment block above the change documents the layout so the next person to touch it
doesn't reintroduce the bug.
Verification
pre-commit run book-mlsys-test-units --files book/quarto/contents/vol1/benchmarking/benchmarking.qmd→ Passed locally.pint,pydantic,numpy,pyyaml,rich) are alreadyin
book/tools/dependencies/requirements.txt, whichbook-validate-dev.ymlinstalls.sys.path) resolvesmlsysim.corecorrectly with this patch.What this unblocks
The book publish guard (
infra-publish-guard.yml→book-validate-dev.yml) requiresthe most recent dev validate run to be green. With this fix,
book-publish-livecanbe triggered for vol1 v0.6.0 / vol2 v0.1.0 once the next dev run goes green.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.