hub-gif 6a308179ad test(pipeline): 在 tests/conftest 中 django.setup 以修复收集阶段 AppRegistryNotReady
pytest 收集含 pipeline.jd.runner 的测试时须先加载 Django;全量 pipeline/tests 现可一次跑通。

Made-with: Cursor
2026-04-17 14:56:35 +08:00

11 lines
287 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""在收集本目录测试模块之前初始化 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()