fix(test): stub app.infrastructure.sites in subprocess tests for CI

CI 无站点二进制模块,子进程测试绕过 conftest 垫片导致
test_manifest_aliases_reuse_real_canonical_modules 与
test_main_script_does_not_shadow_stdlib_platform 失败。
在子进程中复用 ensure_sites_stub,并给垫片补 __spec__。
This commit is contained in:
jxxghp
2026-08-14 18:18:06 +08:00
parent 7b3444c366
commit fe0b444ceb
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -165,6 +165,9 @@ def test_manifest_aliases_reuse_real_canonical_modules():
code = """
import importlib
from app.compat.manifest import MODULE_ALIASES
# CI 无 app.infrastructure.sites 二进制模块,先补垫片再校验全部映射(与 conftest 同源)。
from app.testing.bootstrap import ensure_sites_stub
ensure_sites_stub()
for legacy_name, alias in MODULE_ALIASES.items():
try: