Commit c56681c1 authored by André Anjos's avatar André Anjos 💬
Browse files

[settings] Allow tests to be sped-up by preserving the test database

parent 5aa3792b
......@@ -294,6 +294,17 @@ Or, to generate an HTML report::
$ ./bin/coverate html
.. tip::
You may significatively speed-up your testing by re-using the same test
database from run to run. In order to do this, just specify the flag
``--keepdb`` when you run your tests::
$ ./bin/django test --settings=beat.web.settings.test -v 2 --keepdb
In this case, Django will create and keep a test database called
``test.sql3`` on your current directory. You may delete it when you're done.
.. _snapshot:
Local Development Server
......
......@@ -36,8 +36,10 @@ ALLOWED_HOSTS = [
'testserver',
]
# To always use a (in-memory) sqlite3 database for the tests
DATABASES['default'] = { 'ENGINE': 'django.db.backends.sqlite3' }
import sys
if '-k' in sys.argv or '--keepdb' in sys.argv:
# keeps the SQLite3 database around to avoid re-running migrations
DATABASES['default']['TEST'] = {'NAME': 'test.sql3'}
PREFIX = os.path.join(os.getcwd(), 'test_prefix')
ALGORITHMS_ROOT = os.path.join(PREFIX, 'algorithms')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment