Explorar el Código

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

This allows the Hue unit tests to use databases other than SQLite.
Erick Tryzelaar hace 10 años
padre
commit
caf68f5
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  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,
   }