test(pipeline): 在 tests/conftest 中 django.setup 以修复收集阶段 AppRegistryNotReady

pytest 收集含 pipeline.jd.runner 的测试时须先加载 Django;全量 pipeline/tests 现可一次跑通。

Made-with: Cursor
This commit is contained in:
hub-gif 2026-04-17 14:56:35 +08:00
parent e4a05f3ce6
commit 6a308179ad

View File

@ -0,0 +1,10 @@
"""在收集本目录测试模块之前初始化 Django避免 ``import pipeline.jd.runner`` 触发 AppRegistryNotReady。"""
from __future__ import annotations
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
import django # noqa: E402
django.setup()