from .base import * # noqa: F403 DEBUG = False DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } } PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] CELERY_TASK_ALWAYS_EAGER = True CELERY_TASK_EAGER_PROPAGATES = True # 本机 .env 常开 CREATION_AGENT_INLINE=true,走的是 transaction.on_commit + 后台线程; # 而 TestCase 的事务永远不提交,on_commit 回调不会触发 → agent turn 一轮都不跑, # 一整批编排测试会凭空变红(fake.calls 为空、卡片没落库)。测试必须走 eager Celery。 # 队列同时钉成 airshelf.local,跳过 require_worker_task 的 broker 探测。 CREATION_AGENT_INLINE = False CREATION_AGENT_TASK_QUEUE = "airshelf.local" # 测试必须完全离线:base.py 的 Redis cache 会让 billing 等普通业务逻辑在 # 单测中意外连到实际环境。测试用进程内缓存即可,既不依赖网络,也不会碰线上数据。 CACHES = { "default": { "BACKEND": "django.core.cache.backends.locmem.LocMemCache", "LOCATION": "airshelf-test-cache", } }