mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Enforce usage of sqlite3 for running tests
- Simplifies tests by creating a database in memory - Does not affect the user setup at all
This commit is contained in:
parent
9f5325d61f
commit
41bfdc1432
@ -159,7 +159,19 @@ WSGI_APPLICATION = 'InvenTree.wsgi.application'
|
|||||||
|
|
||||||
DATABASES = {}
|
DATABASES = {}
|
||||||
|
|
||||||
|
"""
|
||||||
|
When running unit tests, enforce usage of sqlite3 database,
|
||||||
|
so that the tests can be run in RAM without any setup requirements
|
||||||
|
"""
|
||||||
|
if 'test' in sys.argv:
|
||||||
|
eprint('Running tests - Using sqlite3 memory database')
|
||||||
|
DATABASES['default'] = {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': 'test_db.sqlite3'
|
||||||
|
}
|
||||||
|
|
||||||
# Database backend selection
|
# Database backend selection
|
||||||
|
else:
|
||||||
if 'database' in CONFIG:
|
if 'database' in CONFIG:
|
||||||
DATABASES['default'] = CONFIG['database']
|
DATABASES['default'] = CONFIG['database']
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user