mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor: reorganize backend module boundaries
This commit is contained in:
@@ -9,13 +9,13 @@ MAIN_PATH = PROJECT_ROOT / "app" / "main.py"
|
||||
|
||||
|
||||
def test_main_script_does_not_shadow_stdlib_platform(tmp_path):
|
||||
"""PyCharm 脚本启动路径不得让 app/platform 遮蔽标准库 platform。"""
|
||||
"""PyCharm 脚本启动路径必须解析到标准库 platform。"""
|
||||
probe = "\n".join(
|
||||
(
|
||||
"import runpy",
|
||||
"import sys",
|
||||
# CI 无 app.infrastructure.sites 二进制模块,先补垫片再执行 main.py(与 conftest 同源);
|
||||
# 必须在篡改 sys.path / 摘除 platform 之前调用,避免真实模块依赖链误引被遮蔽的 app/platform。
|
||||
# CI 无 app.application.site.sites 二进制模块,先补垫片再执行 main.py(与 conftest 同源);
|
||||
# 必须在篡改 sys.path / 摘除 platform 之前调用,避免真实依赖链受探针环境影响。
|
||||
"from app.testing.bootstrap import ensure_sites_stub",
|
||||
"ensure_sites_stub()",
|
||||
f"sys.path.insert(0, {str(MAIN_PATH.parent)!r})",
|
||||
@@ -23,7 +23,7 @@ def test_main_script_does_not_shadow_stdlib_platform(tmp_path):
|
||||
f"runpy.run_path({str(MAIN_PATH)!r}, run_name='pycharm_main_probe')",
|
||||
"import platform",
|
||||
"assert hasattr(platform, 'python_implementation')",
|
||||
"assert '/app/platform/' not in str(getattr(platform, '__file__', ''))",
|
||||
f"assert {str(MAIN_PATH.parent)!r} not in str(getattr(platform, '__file__', ''))",
|
||||
)
|
||||
)
|
||||
env = {
|
||||
|
||||
Reference in New Issue
Block a user