Merge branch 'master' into github-3408-production-datamanager
[arvados.git] / sdk / python / tests / run_test_server.py
index 271b525df2bc8cd404feb357c1ea3d080fd037e6..02f65e6caf47470928fbbe7fcbee2cafb490e817 100644 (file)
@@ -165,6 +165,15 @@ def run(leave_running_atexit=False):
     # died, or we have lost our credentials, or something else is
     # preventing us from calling reset(). Start a new one.
 
+    if not os.path.exists('tmp'):
+        os.makedirs('tmp')
+
+    if not os.path.exists('tmp/api'):
+        os.makedirs('tmp/api')
+
+    if not os.path.exists('tmp/logs'):
+        os.makedirs('tmp/logs')
+
     if not os.path.exists('tmp/self-signed.pem'):
         # We assume here that either passenger reports its listening
         # address as https:/0.0.0.0:port/. If it reports "127.0.0.1"
@@ -444,10 +453,13 @@ def _getport(program):
 def _apiconfig(key):
     if _cached_config:
         return _cached_config[key]
-    def _load(f):
-        return yaml.load(os.path.join(SERVICES_SRC_DIR, 'api', 'config', f))
+    def _load(f, required=True):
+        fullpath = os.path.join(SERVICES_SRC_DIR, 'api', 'config', f)
+        if not required and not os.path.exists(fullpath):
+            return {}
+        return yaml.load(fullpath)
     cdefault = _load('application.default.yml')
-    csite = _load('application.yml')
+    csite = _load('application.yml', required=False)
     _cached_config = {}
     for section in [cdefault.get('common',{}), cdefault.get('test',{}),
                     csite.get('common',{}), csite.get('test',{})]: