postgresql - How can we make Django tests faster? -


we using django 1.4 postgresql on ubuntu 12.04. have many tests, , problem running tests slow, think because each test database created scratch. want make tests faster running them database in memory (not hard disk). how do it? have links or tutorials?

the best option have separate settings file tests. in settings_test.py tell use sqlite default use in-memory database:

from base_settings import *  databases = {   'default': {     'engine': 'django.db.backends.sqlite3',     'name': ':memory'   } } 

and run tests adding --settings=settings_test

see django docs:
https://docs.djangoproject.com/en/dev/topics/testing/overview/#the-test-database


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -