From 15dd0039c7c76ff6e35769510022bfbebac94e5f Mon Sep 17 00:00:00 2001 From: Chris Church Date: Fri, 28 Jun 2013 06:07:58 -0400 Subject: [PATCH] Added setting for production builds to be able to run tests using SQLite. --- awx/settings/local_settings.py.example | 6 +++--- config/deb/settings.py | 11 +++++++++++ config/rpm/settings.py | 11 +++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/awx/settings/local_settings.py.example b/awx/settings/local_settings.py.example index 306b07ed34..4ef920b675 100644 --- a/awx/settings/local_settings.py.example +++ b/awx/settings/local_settings.py.example @@ -22,13 +22,13 @@ DATABASES = { } } -# Continue to use SQLite for unit tests instead of PostgreSQL. -if 'test' in sys.argv: +# 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': 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'), } } diff --git a/config/deb/settings.py b/config/deb/settings.py index c53f6a479a..1b020775d9 100644 --- a/config/deb/settings.py +++ b/config/deb/settings.py @@ -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' PROJECTS_ROOT = '/var/lib/awx/projects' diff --git a/config/rpm/settings.py b/config/rpm/settings.py index 1ecde70c37..ce0d2c5e16 100644 --- a/config/rpm/settings.py +++ b/config/rpm/settings.py @@ -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' PROJECTS_ROOT = '/var/lib/awx/projects'