JianFeeeee
bea8aefd8d
test: stop hardcoding an out-of-repo sys.path in test_protocol.py
tests/test_protocol.py 原本把 "/home/program/NextAgent/src" 硬编码进
sys.path,指向宿主机上另一份(工作区为脏的)NextAgent 检出。结果测试
import 的是那份副本而非本仓库的 src,导致两个用例失败:
- test_decode_raises_on_wrong_fmt_id → DecodingError not raised
- test_register_and_send → ValueError: inhomogeneous shape
改为基于 __file__ 推导仓库内的 src/ 路径,测试不再依赖仓库外的任何
绝对路径,任何检出位置都能跑通。实现代码未做改动——这是测试耦合问题,
不是实现 bug。
同时取消跟踪 7 个误提交的 .pyc(.gitignore 规则此前加晚了)。
仅 git rm --cached,工作区文件保留;.gitignore 的 __pycache__/ 与 *.pyc
规则继续生效。
python3 -m unittest discover -s tests → Ran 31 tests, OK
git ls-files '*.pyc' | wc -l → 0