Added setting for production builds to be able to run tests using SQLite.

This commit is contained in:
Chris Church
2013-06-28 06:07:58 -04:00
parent 395685b23b
commit 15dd0039c7
3 changed files with 25 additions and 3 deletions

View File

@@ -22,13 +22,13 @@ DATABASES = {
} }
} }
# Continue to use SQLite for unit tests instead of PostgreSQL. # Use SQLite for unit tests instead of PostgreSQL.
if 'test' in sys.argv: if len(sys.argv) >= 2 and sys.argv[1] == 'test':
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'awx.sqlite3'), 'NAME': os.path.join(BASE_DIR, 'awx.sqlite3'),
# Test database cannot be :memory: for celery/inventory tests to work. # Test database cannot be :memory: for celery/inventory tests.
'TEST_NAME': os.path.join(BASE_DIR, 'awx_test.sqlite3'), 'TEST_NAME': os.path.join(BASE_DIR, 'awx_test.sqlite3'),
} }
} }

View File

@@ -13,6 +13,17 @@ DATABASES = {
} }
} }
# Use SQLite for unit tests instead of PostgreSQL.
if len(sys.argv) >= 2 and sys.argv[1] == 'test':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'var/lib/awx/awx.sqlite3',
# Test database cannot be :memory: for celery/inventory tests.
'TEST_NAME': '/var/lib/awx/awx_test.sqlite3',
}
}
STATIC_ROOT = '/var/lib/awx/public/static' STATIC_ROOT = '/var/lib/awx/public/static'
PROJECTS_ROOT = '/var/lib/awx/projects' PROJECTS_ROOT = '/var/lib/awx/projects'

View File

@@ -13,6 +13,17 @@ DATABASES = {
} }
} }
# Use SQLite for unit tests instead of PostgreSQL.
if len(sys.argv) >= 2 and sys.argv[1] == 'test':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'var/lib/awx/awx.sqlite3',
# Test database cannot be :memory: for celery/inventory tests.
'TEST_NAME': '/var/lib/awx/awx_test.sqlite3',
}
}
STATIC_ROOT = '/var/lib/awx/public/static' STATIC_ROOT = '/var/lib/awx/public/static'
PROJECTS_ROOT = '/var/lib/awx/projects' PROJECTS_ROOT = '/var/lib/awx/projects'