Hi I would like to create a separate empty database for tests. I read on django docs (https://docs.djangoproject.com/en/2.1/topics/testing/overview/) that :
The default test database names are created by prepending test_ to the value of each NAME in DATABASES. When using SQLite, the tests will use an in-memory database by default (i.e., the database will be created in memory, bypassing the filesystem entirely!). The TEST dictionary in DATABASES offers a number of settings to configure your test database. For example, if you want to use a different database name, specify NAME in the TEST dictionary for any given database in DATABASES.
So I tried:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
},
'test_db': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'test_db.sqlite3'),
}
}
but tests still use the default database when running them with
./manage.py test
How can I create and specify a new, empty database for tests purposes?
default, buttest_default, so it already creates a test database without specifying one.