27 lines
550 B
Python
27 lines
550 B
Python
"""测试环境配置:内存 SQLite + pytest。"""
|
|
|
|
from .base import * # noqa
|
|
|
|
DEBUG = False
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
"NAME": ":memory:",
|
|
}
|
|
}
|
|
|
|
# 测试时禁用迁移,按需 fixture 创建 schema
|
|
class DisableMigrations:
|
|
def __contains__(self, item):
|
|
return True
|
|
|
|
def __getitem__(self, item):
|
|
return None
|
|
|
|
|
|
MIGRATION_MODULES = DisableMigrations()
|
|
|
|
# 测试用 PASSWORD_HASHERS 加速
|
|
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|