cubicweb/devtools/__init__.py
changeset 11269 73ac69970047
parent 11267 c2e7fd344b90
child 11756 60fed6272771
--- a/cubicweb/devtools/__init__.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/devtools/__init__.py	Fri May 20 12:01:42 2016 +0200
@@ -30,7 +30,7 @@
 import tempfile
 import getpass
 from hashlib import sha1  # pylint: disable=E0611
-from os.path import abspath, join, exists, split, isabs, isdir
+from os.path import abspath, join, exists, split, isdir, dirname
 from functools import partial
 
 from six import text_type
@@ -140,18 +140,15 @@
     skip_db_create_and_restore = False
     default_sources = DEFAULT_SOURCES
 
-    def __init__(self, appid='data', apphome=None, log_threshold=logging.CRITICAL+10):
+    def __init__(self, appid, test_module_file, log_threshold=logging.CRITICAL + 10):
         # must be set before calling parent __init__
-        if apphome is None:
-            if exists(appid):
-                apphome = abspath(appid)
-            else: # cube test
-                apphome = abspath('..')
+        apphome = abspath(join(dirname(test_module_file), appid))
         self._apphome = apphome
         super(TestServerConfiguration, self).__init__(appid)
         self.init_log(log_threshold, force=True)
         # need this, usually triggered by cubicweb-ctl
         self.load_cwctl_plugins()
+        self.test_module_file = test_module_file
 
     # By default anonymous login are allow but some test need to deny of to
     # change the default user. Set it to None to prevent anonymous login.
@@ -236,13 +233,6 @@
     # considered initialized
     skip_db_create_and_restore = False
 
-    def __init__(self, appid, apphome=None,
-                 log_threshold=logging.WARNING, sourcefile=None):
-        BaseApptestConfiguration.__init__(self, appid, apphome,
-                                          log_threshold=log_threshold)
-        self.init_repository = sourcefile is None
-        self.sourcefile = sourcefile
-
 
 class PostgresApptestConfiguration(ApptestConfiguration):
     default_sources = DEFAULT_PSQL_SOURCES