【发布时间】:2018-08-27 09:28:17
【问题描述】:
通过运行“./manage.py test”,来自本地“postgres”数据库的数据被填充到“test_postgres”数据库中。我无法找到方法,如何禁用此行为。 通过运行“./manage.py test”,我想获得具有应用迁移的非填充数据库。
class Local(Common):
DEBUG = True
# Testing
INSTALLED_APPS = Common.INSTALLED_APPS
INSTALLED_APPS += ('django_nose',)
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
BASE_DIR,
'-s',
'--nologcapture',
'--with-coverage',
'--with-progressive'
]
# Postgres
DATABASES = {
'default': dj_database_url.config(
default='postgres://postgres:@postgres:5432/postgres',
conn_max_age=int(os.getenv('POSTGRES_CONN_MAX_AGE', 600)),
)
}
【问题讨论】:
标签: python django unit-testing django-testing django-tests