27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""pytest 夹具:把模块根与 scripts/ 注入 sys.path(M11b-2c-A)。
|
||
|
||
本文件只做导入路径与可发现性修复,不含业务断言、不改业务实现:
|
||
* ROOT = modules/pbl_runtime_ext → 让 `import pbl_runtime_ext` 可解析
|
||
* ROOT/scripts = modules/pbl_runtime_ext/scripts → 让 selftest / p99 probe 可被复用导入
|
||
|
||
历史问题(QC #1 硬门禁):tests/test_m11b1a_ddl_runtime.py 是 **脚本式 harness**
|
||
(main() + sys.exit),没有任何 `test_` 函数,因此 `pytest tests/` 收集结果为
|
||
`collected 0 items`(退出码 5)。本轮新增 test_m11b2c_runtime_ext.py 以 pytest
|
||
原生用例形式包装同一套被验对象,使 pytest 能真实收集并执行断言。
|
||
"""
|
||
|
||
import os
|
||
import sys
|
||
|
||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||
ROOT = os.path.dirname(HERE)
|
||
SCRIPTS = os.path.join(ROOT, "scripts")
|
||
|
||
for _p in (ROOT, SCRIPTS):
|
||
if _p not in sys.path:
|
||
sys.path.insert(0, _p)
|
||
|
||
# selftest 的内存事务引擎与真实 tx_write 主链路依赖这些路径常量
|
||
os.environ.setdefault("PBL_RUNTIME_EXT_ROOT", ROOT)
|