mirror of
https://github.com/primedigitaltech/market-assistant.git
synced 2026-07-21 23:41:39 +08:00
test(pipeline): 在 tests/conftest 中 django.setup 以修复收集阶段 AppRegistryNotReady
pytest 收集含 pipeline.jd.runner 的测试时须先加载 Django;全量 pipeline/tests 现可一次跑通。 Made-with: Cursor
This commit is contained in:
parent
e4a05f3ce6
commit
6a308179ad
10
backend/pipeline/tests/conftest.py
Normal file
10
backend/pipeline/tests/conftest.py
Normal 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()
|
||||
Loading…
x
Reference in New Issue
Block a user