test: 隔离单测中的站点原生资源 (#6452)

* test: isolate native site resources

* refactor(test): retain sites stub helper contract

* fix(test): preserve sites stub probe imports

---------

Co-authored-by: jxxghp <jxxghp@gmail.com>
This commit is contained in:
InfinityPacer
2026-08-25 16:26:46 +08:00
committed by GitHub
co-authored by jxxghp
parent f3622de82e
commit c727d9c9f1
10 changed files with 31 additions and 49 deletions
+1 -2
View File
@@ -302,8 +302,7 @@ import app.monitor
assert not any(name.startswith('app.doctor.') for name in sys.modules)
assert not any(name.startswith('app.monitor.') for name in sys.modules)
# CI 无 app.application.site.sites 资源模块,触发实现加载前先补 conftest 同源垫片;
# 独立子进程不经过 pytest 引导,必须在此显式安装,否则链式 import 会因缺模块失败。
# 独立子进程不经过 pytest 引导,触发实现加载前必须隔离站点原生制品。
from app.testing.bootstrap import ensure_sites_stub
ensure_sites_stub()