Django Testing: Does --keepdb reset changes made during tests? -
according django docs regarding tests, --keepdb flag preserve the test database future runs.
https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-option---keepdb
just clear, changes made database tests (ie: object.save() ) reset automatically? or these changes need reversed within tests?
if you're using django's default testcase, tests run in transaction, rolled when tests finishes. if database supports transactions, won't have clean anything.
if you're using django's liveservertestcase or transactiontestcase, tables truncated after each test, , initial data, serialized before test, reloaded test database. not preserve data migrated apps, unmigrated apps.
the --keepdb option not special database. prevents test database destroyed, , if database found @ start of tests, used instead of creating new one. so, data somehow left in database when tests finish seen initial data. relevant if error or user interrupt prevents tests without transactions cleaning database. in case may idea recreate database.
Comments
Post a Comment