changeset 2560:380d6d86da1f beta

Added option to swap the db connection uri based on ENV TEST_DB string
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 06 Jul 2012 16:24:26 +0200
parents 0c461d0cb846
children 6ccf86ebfd4e
files rhodecode/config/environment.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/config/environment.py	Fri Jul 06 15:55:10 2012 +0200
+++ b/rhodecode/config/environment.py	Fri Jul 06 16:24:26 2012 +0200
@@ -72,6 +72,10 @@
     config['pylons.strict_tmpl_context'] = True
     test = os.path.split(config['__file__'])[-1] == 'test.ini'
     if test:
+        if os.environ.get('TEST_DB'):
+            # swap config if we pass enviroment variable
+            config['sqlalchemy.db1.url'] = os.environ.get('TEST_DB')
+
         from rhodecode.lib.utils import create_test_env, create_test_index
         from rhodecode.tests import  TESTS_TMP_PATH
         create_test_env(TESTS_TMP_PATH, config)
@@ -80,7 +84,6 @@
     # MULTIPLE DB configs
     # Setup the SQLAlchemy database engine
     sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
-
     init_model(sa_engine_db1)
 
     repos_path = make_ui('db').configitems('paths')[0][1]