浏览代码

[desktop] Optionally parse the test database name from the environment

This allows the Hue unit tests to use databases other than SQLite.
Erick Tryzelaar 10 年之前
父节点
当前提交
caf68f5bfe
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      desktop/core/src/desktop/settings.py

+ 6 - 1
desktop/core/src/desktop/settings.py

@@ -287,6 +287,11 @@ if os.getenv('DESKTOP_DB_CONFIG'):
     ["ENGINE", "NAME", "TEST_NAME", "USER", "PASSWORD", "HOST", "PORT"],
     conn_string.split(':')))
 else:
+  test_name = os.environ.get('DESKTOP_DB_TEST_NAME')
+  logging.debug("DESKTOP_DB_TEST_NAME SET: %s" % test_name)
+  if test_name is None:
+    test_name = get_desktop_root('desktop-test.db')
+
   default_db = {
     "ENGINE" : desktop.conf.DATABASE.ENGINE.get(),
     "NAME" : desktop.conf.DATABASE.NAME.get(),
@@ -296,7 +301,7 @@ else:
     "PORT" : str(desktop.conf.DATABASE.PORT.get()),
     "OPTIONS": force_dict_to_strings(desktop.conf.DATABASE.OPTIONS.get()),
     # DB used for tests
-    "TEST_NAME" : get_desktop_root('desktop-test.db'),
+    "TEST_NAME" : test_name,
     # Wrap each request in a transaction.
     "ATOMIC_REQUESTS" : True,
   }