[devtools] Simplify test configuration's init
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 20 May 2016 12:01:42 +0200
changeset 11269 73ac69970047
parent 11268 f6938ae0dea8
child 11270 a9dc97b87ced
[devtools] Simplify test configuration's init Specify module's __file__ instead of apphome. __file__ is saved on the class as it will be used later (eg to find the proper pg cluster without relying on shared dictionnary modifications). This will require some tests update, but it should be less common in cubes than in cubicweb itself.
cubicweb/devtools/__init__.py
cubicweb/devtools/test/unittest_dbfill.py
cubicweb/devtools/testlib.py
cubicweb/server/test/unittest_checkintegrity.py
cubicweb/server/test/unittest_hook.py
cubicweb/server/test/unittest_querier.py
cubicweb/server/test/unittest_rql2sql.py
cubicweb/server/test/unittest_rqlannotation.py
cubicweb/server/test/unittest_schemaserial.py
cubicweb/server/test/unittest_serverctl.py
cubicweb/server/test/unittest_ssplanner.py
cubicweb/test/data-rewrite/bootstrap_cubes
cubicweb/test/data-rewrite/schema.py
cubicweb/test/data/rewrite/__init__.py
cubicweb/test/data/rewrite/bootstrap_cubes
cubicweb/test/data/rewrite/schema.py
cubicweb/test/unittest_cwconfig.py
cubicweb/test/unittest_migration.py
cubicweb/test/unittest_rqlrewrite.py
cubicweb/test/unittest_schema.py
cubicweb/test/unittest_spa2rql.py
cubicweb/test/unittest_vregistry.py
cubicweb/web/test/unittest_formfields.py
cubicweb/web/test/unittest_webconfig.py
--- 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
--- a/cubicweb/devtools/test/unittest_dbfill.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/devtools/test/unittest_dbfill.py	Fri May 20 12:01:42 2016 +0200
@@ -56,7 +56,7 @@
         return [f.strip() for f in io.open(osp.join(DATADIR, 'firstnames.txt'), encoding='latin1')]
 
     def setUp(self):
-        config = ApptestConfiguration('data', apphome=DATADIR)
+        config = ApptestConfiguration('data', __file__)
         config.bootstrap_cubes()
         schema = config.load_schema()
         e_schema = schema.eschema('Person')
--- a/cubicweb/devtools/testlib.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/devtools/testlib.py	Fri May 20 12:01:42 2016 +0200
@@ -378,8 +378,8 @@
         try:
             return cls.__dict__['_config']
         except KeyError:
-            home = abspath(join(dirname(sys.modules[cls.__module__].__file__), cls.appid))
-            config = cls._config = cls.configcls(cls.appid, apphome=home)
+            test_module_file = sys.modules[cls.__module__].__file__
+            config = cls._config = cls.configcls(cls.appid, test_module_file)
             config.mode = 'test'
             return config
 
--- a/cubicweb/server/test/unittest_checkintegrity.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_checkintegrity.py	Fri May 20 12:01:42 2016 +0200
@@ -33,7 +33,7 @@
 class CheckIntegrityTC(TestCase):
 
     def setUp(self):
-        handler = get_test_db_handler(TestServerConfiguration(apphome=self.datadir))
+        handler = get_test_db_handler(TestServerConfiguration('data', __file__))
         handler.build_db_cache()
         self.repo, _cnx = handler.get_repo_and_cnx()
         sys.stderr = sys.stdout = StringIO()
--- a/cubicweb/server/test/unittest_hook.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_hook.py	Fri May 20 12:01:42 2016 +0200
@@ -57,7 +57,7 @@
 
 class HookCalled(Exception): pass
 
-config = TestServerConfiguration('data')
+config = TestServerConfiguration('data', __file__)
 config.bootstrap_cubes()
 schema = config.load_schema()
 
--- a/cubicweb/server/test/unittest_querier.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_querier.py	Fri May 20 12:01:42 2016 +0200
@@ -66,7 +66,7 @@
 
 def setUpClass(cls, *args):
     global repo, cnx
-    config = TestServerConfiguration(apphome=UtilsTC.datadir)
+    config = TestServerConfiguration('data', __file__)
     handler = get_test_db_handler(config)
     handler.build_db_cache()
     repo, cnx = handler.get_repo_and_cnx()
--- a/cubicweb/server/test/unittest_rql2sql.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_rql2sql.py	Fri May 20 12:01:42 2016 +0200
@@ -61,7 +61,7 @@
 
 def setUpModule():
     global config, schema
-    config = TestServerConfiguration('data', apphome=CWRQLTC.datadir)
+    config = TestServerConfiguration('data', __file__)
     config.bootstrap_cubes()
     schema = config.load_schema()
     schema['in_state'].inlined = True
--- a/cubicweb/server/test/unittest_rqlannotation.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_rqlannotation.py	Fri May 20 12:01:42 2016 +0200
@@ -24,8 +24,7 @@
 class SQLGenAnnotatorTC(BaseQuerierTC):
 
     def setUp(self):
-        handler = get_test_db_handler(TestServerConfiguration(
-            'data2', apphome=SQLGenAnnotatorTC.datadir))
+        handler = get_test_db_handler(TestServerConfiguration('data', __file__))
         handler.build_db_cache()
         repo, _cnx = handler.get_repo_and_cnx()
         self.__class__.repo = repo
--- a/cubicweb/server/test/unittest_schemaserial.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_schemaserial.py	Fri May 20 12:01:42 2016 +0200
@@ -38,8 +38,7 @@
 
     global schema, config
     loader = CubicWebSchemaLoader()
-    apphome = Schema2RQLTC.datadir + '-schemaserial'
-    config = TestServerConfiguration('data', apphome=apphome)
+    config = TestServerConfiguration('data-schemaserial', __file__)
     config.bootstrap_cubes()
     schema = loader.load(config)
 
--- a/cubicweb/server/test/unittest_serverctl.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_serverctl.py	Fri May 20 12:01:42 2016 +0200
@@ -9,7 +9,7 @@
     def setUp(self):
         super(ServerCTLTC, self).setUp()
         self.orig_config_for = ServerConfiguration.config_for
-        config_for = lambda appid: ApptestConfiguration(appid, apphome=self.datadir)
+        config_for = lambda appid: ApptestConfiguration(appid, __file__)
         ServerConfiguration.config_for = staticmethod(config_for)
 
     def tearDown(self):
--- a/cubicweb/server/test/unittest_ssplanner.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/server/test/unittest_ssplanner.py	Fri May 20 12:01:42 2016 +0200
@@ -23,8 +23,7 @@
 # keep cnx so it's not garbage collected and the associated session closed
 def setUpModule(*args):
     global repo, cnx
-    handler = get_test_db_handler(TestServerConfiguration(
-            'data', apphome=SSPlannerTC.datadir))
+    handler = get_test_db_handler(TestServerConfiguration('data', __file__))
     handler.build_db_cache()
     global repo, cnx
     repo, cnx = handler.get_repo_and_cnx()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/test/data-rewrite/bootstrap_cubes	Fri May 20 12:01:42 2016 +0200
@@ -0,0 +1,1 @@
+card,localperms
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/test/data-rewrite/schema.py	Fri May 20 12:01:42 2016 +0200
@@ -0,0 +1,124 @@
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
+#
+# This file is part of CubicWeb.
+#
+# CubicWeb is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
+from yams.buildobjs import (EntityType, RelationDefinition, String, SubjectRelation,
+                            ComputedRelation, Int)
+from cubicweb.schema import ERQLExpression
+
+
+class Person(EntityType):
+    name = String()
+
+
+class Affaire(EntityType):
+    __permissions__ = {
+        'read':   ('managers',
+                   ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')),
+        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
+        'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
+        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
+        }
+    ref = String(fulltextindexed=True, indexed=True, maxsize=16)
+    documented_by = SubjectRelation('Card', cardinality='1*')
+    concerne = SubjectRelation(('Societe', 'Note'), cardinality='1*')
+
+
+class Societe(EntityType):
+    __permissions__ = {
+        'read': ('managers', 'users', 'guests'),
+        'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
+        'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
+        'add': ('managers', 'users',)
+        }
+    nom = String()
+
+
+class Division(Societe):
+    __specializes_schema__ = True
+
+
+class Note(EntityType):
+    pass
+
+
+class require_permission(RelationDefinition):
+    subject = ('Card', 'Note')
+    object = 'CWPermission'
+
+
+class require_state(RelationDefinition):
+    subject = 'CWPermission'
+    object = 'State'
+
+
+class inlined_card(RelationDefinition):
+    subject = 'Affaire'
+    object = 'Card'
+    inlined = True
+    cardinality = '?*'
+
+class inlined_note(RelationDefinition):
+    subject = 'Card'
+    object = 'Note'
+    inlined = True
+    cardinality = '?*'
+
+class inlined_affaire(RelationDefinition):
+    subject = 'Note'
+    object = 'Affaire'
+    inlined = True
+    cardinality = '?*'
+
+class responsable(RelationDefinition):
+    subject = 'Societe'
+    object = 'CWUser'
+    inlined = True
+    cardinality = '1*'
+
+class Contribution(EntityType):
+    code = Int()
+
+class ArtWork(EntityType):
+    name = String()
+
+class Role(EntityType):
+    name = String()
+
+class contributor(RelationDefinition):
+    subject = 'Contribution'
+    object = 'Person'
+    cardinality = '1*'
+    inlined = True
+
+class manifestation(RelationDefinition):
+    subject = 'Contribution'
+    object = 'ArtWork'
+
+class role(RelationDefinition):
+    subject = 'Contribution'
+    object = 'Role'
+
+class illustrator_of(ComputedRelation):
+    rule = ('C is Contribution, C contributor S, C manifestation O, '
+            'C role R, R name "illustrator"')
+
+class participated_in(ComputedRelation):
+    rule = 'S contributor O'
+
+class match(RelationDefinition):
+    subject = 'ArtWork'
+    object = 'Note'
--- a/cubicweb/test/data/rewrite/__init__.py	Thu Sep 11 14:22:02 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
--- a/cubicweb/test/data/rewrite/bootstrap_cubes	Thu Sep 11 14:22:02 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-card,localperms
--- a/cubicweb/test/data/rewrite/schema.py	Thu Sep 11 14:22:02 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of CubicWeb.
-#
-# CubicWeb is free software: you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-from yams.buildobjs import (EntityType, RelationDefinition, String, SubjectRelation,
-                            ComputedRelation, Int)
-from cubicweb.schema import ERQLExpression
-
-
-class Person(EntityType):
-    name = String()
-
-
-class Affaire(EntityType):
-    __permissions__ = {
-        'read':   ('managers',
-                   ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')),
-        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
-        'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
-        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
-        }
-    ref = String(fulltextindexed=True, indexed=True, maxsize=16)
-    documented_by = SubjectRelation('Card', cardinality='1*')
-    concerne = SubjectRelation(('Societe', 'Note'), cardinality='1*')
-
-
-class Societe(EntityType):
-    __permissions__ = {
-        'read': ('managers', 'users', 'guests'),
-        'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
-        'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
-        'add': ('managers', 'users',)
-        }
-    nom = String()
-
-
-class Division(Societe):
-    __specializes_schema__ = True
-
-
-class Note(EntityType):
-    pass
-
-
-class require_permission(RelationDefinition):
-    subject = ('Card', 'Note')
-    object = 'CWPermission'
-
-
-class require_state(RelationDefinition):
-    subject = 'CWPermission'
-    object = 'State'
-
-
-class inlined_card(RelationDefinition):
-    subject = 'Affaire'
-    object = 'Card'
-    inlined = True
-    cardinality = '?*'
-
-class inlined_note(RelationDefinition):
-    subject = 'Card'
-    object = 'Note'
-    inlined = True
-    cardinality = '?*'
-
-class inlined_affaire(RelationDefinition):
-    subject = 'Note'
-    object = 'Affaire'
-    inlined = True
-    cardinality = '?*'
-
-class responsable(RelationDefinition):
-    subject = 'Societe'
-    object = 'CWUser'
-    inlined = True
-    cardinality = '1*'
-
-class Contribution(EntityType):
-    code = Int()
-
-class ArtWork(EntityType):
-    name = String()
-
-class Role(EntityType):
-    name = String()
-
-class contributor(RelationDefinition):
-    subject = 'Contribution'
-    object = 'Person'
-    cardinality = '1*'
-    inlined = True
-
-class manifestation(RelationDefinition):
-    subject = 'Contribution'
-    object = 'ArtWork'
-
-class role(RelationDefinition):
-    subject = 'Contribution'
-    object = 'Role'
-
-class illustrator_of(ComputedRelation):
-    rule = ('C is Contribution, C contributor S, C manifestation O, '
-            'C role R, R name "illustrator"')
-
-class participated_in(ComputedRelation):
-    rule = 'S contributor O'
-
-class match(RelationDefinition):
-    subject = 'ArtWork'
-    object = 'Note'
--- a/cubicweb/test/unittest_cwconfig.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/test/unittest_cwconfig.py	Fri May 20 12:01:42 2016 +0200
@@ -43,7 +43,7 @@
 class CubicWebConfigurationTC(TestCase):
     def setUp(self):
         cleanup_sys_modules([CUSTOM_CUBES_DIR, ApptestConfiguration.CUBES_DIR])
-        self.config = ApptestConfiguration('data', apphome=self.datadir)
+        self.config = ApptestConfiguration('data', __file__)
         self.config._cubes = ('email', 'file')
 
     def tearDown(self):
--- a/cubicweb/test/unittest_migration.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/test/unittest_migration.py	Fri May 20 12:01:42 2016 +0200
@@ -43,7 +43,7 @@
 
 class MigrationToolsTC(TestCase):
     def setUp(self):
-        self.config = MigrTestConfig('data')
+        self.config = MigrTestConfig('data', __file__)
         from yams.schema import Schema
         self.config.load_schema = lambda expand_cubes=False: Schema('test')
         self.config.__class__.cubicweb_appobject_path = frozenset()
@@ -74,7 +74,7 @@
                                ((0, 0, 4), TMIGRDIR+'0.0.4_Any.py')])
 
     def test_filter_scripts_for_mode(self):
-        config = CubicWebConfiguration('data')
+        config = CubicWebConfiguration('data', __file__)
         config.verbosity = 0
         config = self.config
         config.__class__.name = 'repository'
@@ -100,7 +100,7 @@
 
     def test_db_creation(self):
         """make sure database can be created"""
-        config = ApptestConfiguration('data', apphome=self.datadir)
+        config = ApptestConfiguration('data', __file__)
         source = config.system_source_config
         self.assertEqual(source['db-driver'], 'sqlite')
         handler = get_test_db_handler(config)
--- a/cubicweb/test/unittest_rqlrewrite.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/test/unittest_rqlrewrite.py	Fri May 20 12:01:42 2016 +0200
@@ -31,7 +31,7 @@
 
 def setUpModule(*args):
     global rqlhelper, schema
-    config = TestServerConfiguration(RQLRewriteTC.datapath('rewrite'))
+    config = TestServerConfiguration('data-rewrite', __file__)
     config.bootstrap_cubes()
     schema = config.load_schema()
     schema.add_relation_def(RelationDefinition(subject='Card', name='in_state',
@@ -498,12 +498,9 @@
                          'EXISTS(NOT S in_group A, A name "guests", A is CWGroup)')
 
 from cubicweb.devtools.testlib import CubicWebTC
-from logilab.common.decorators import classproperty
 
 class RewriteFullTC(CubicWebTC):
-    @classproperty
-    def config(cls):
-        return BaseApptestConfiguration(apphome=cls.datapath('rewrite'))
+    appid = 'data-rewrite'
 
     def process(self, rql, args=None):
         if args is None:
@@ -784,7 +781,7 @@
 
 class RQLRelationRewriterTC(CubicWebTC):
 
-    appid = 'data/rewrite'
+    appid = 'data-rewrite'
 
     def test_base_rule(self):
         with self.admin_access.client_cnx() as cnx:
--- a/cubicweb/test/unittest_schema.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/test/unittest_schema.py	Fri May 20 12:01:42 2016 +0200
@@ -143,7 +143,7 @@
         self.assertEqual(str(expr), 'Any O,U WHERE U has_update_permission O, O eid %(o)s, U eid %(u)s')
 
 loader = CubicWebSchemaLoader()
-config = TestConfiguration('data', apphome=DATADIR)
+config = TestConfiguration('data', __file__)
 config.bootstrap_cubes()
 
 class SchemaReaderClassTest(TestCase):
@@ -269,7 +269,7 @@
 
     def test_relation_perm_overriding(self):
         loader = CubicWebSchemaLoader()
-        config = TestConfiguration('data', apphome=join(dirname(__file__), 'data_schemareader'))
+        config = TestConfiguration('data_schemareader', __file__)
         config.bootstrap_cubes()
         schema = loader.load(config)
         rdef = next(iter(schema['in_group'].rdefs.values()))
--- a/cubicweb/test/unittest_spa2rql.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/test/unittest_spa2rql.py	Fri May 20 12:01:42 2016 +0200
@@ -33,7 +33,7 @@
 xy.add_equivalence('Project name', 'doap:Project dc:title')
 
 
-config = TestServerConfiguration('data')
+config = TestServerConfiguration('data', __file__)
 config.bootstrap_cubes()
 schema = config.load_schema()
 
--- a/cubicweb/test/unittest_vregistry.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/test/unittest_vregistry.py	Fri May 20 12:01:42 2016 +0200
@@ -38,7 +38,7 @@
 class VRegistryTC(TestCase):
 
     def setUp(self):
-        config = TestServerConfiguration('data')
+        config = TestServerConfiguration('data', __file__)
         self.vreg = CWRegistryStore(config)
         config.bootstrap_cubes()
         self.vreg.schema = config.load_schema()
--- a/cubicweb/web/test/unittest_formfields.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/web/test/unittest_formfields.py	Fri May 20 12:01:42 2016 +0200
@@ -31,7 +31,7 @@
 
 def setUpModule(*args):
     global schema
-    config = TestServerConfiguration('data', apphome=GuessFieldTC.datadir)
+    config = TestServerConfiguration('data', __file__)
     config.bootstrap_cubes()
     schema = config.load_schema()
 
--- a/cubicweb/web/test/unittest_webconfig.py	Thu Sep 11 14:22:02 2014 +0200
+++ b/cubicweb/web/test/unittest_webconfig.py	Fri May 20 12:01:42 2016 +0200
@@ -27,7 +27,7 @@
     def setUp(self):
         # need explicit None if dirname(__file__) is empty, see
         # ApptestConfiguration.__init__
-        self.config = ApptestConfiguration('data', apphome=os.path.dirname(__file__) or None)
+        self.config = ApptestConfiguration('data', __file__)
         self.config._cubes = ['file']
         self.config.load_configuration()