I read Q&A why django create test database, but there is no answer on a question.
I have django 1.8.4 version.
My settings.py
if 'test' in sys.argv or 'test_coverage' in sys.argv:
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
Run
time ./manage.py test
Raven is not configured (logging is disabled). Please see the documentation for more information.
/Users/ioganegambaputi/work/foobd/foobd/core/forms.py:7: RemovedInDjango19Warning: The django.forms.util module has been renamed. Use django.forms.utils instead.
from django.forms.util import ErrorList
/Users/ioganegambaputi/work/env/foobd/lib/python2.7/site-packages/templated_email/__init__.py:2: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
from django.utils.importlib import import_module
/Users/ioganegambaputi/work/foobd/foobd/core/utils.py:50: RemovedInDjango19Warning: 'get_cache' is deprecated in favor of 'caches'.
self.cache = cache.get_cache(cache_alias or cache.DEFAULT_CACHE_ALIAS)
Creating test database for alias 'default'...
real 0m53.102s
user 0m47.976s
sys 0m1.544s
The test works about 2-3 seconds, all other time it hangs in Creating test database for alias 'default'...
I think my database should be created in the memory very fast. I have no json dumps loaded. How can I make it faster? It seems I missed something...
UPDATED
If I use --keepdb flag (as noticed in the answer it keeps my database structure, but not the data), anyway, it hangs the same way, but with the Using existing test database for alias 'default'... label (
Creating the test database is a quite heavy task. I think it's normal that it consumes most of the time. But you can use the 'keepdb' flag to keep the database for the next test runs:
python manage.py test --keepdb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With