# HG changeset patch # User Christophe de Vienne # Date 1438247472 -7200 # Node ID daef7ce08fea6c6a0445c57b4632b588da47dd2e # Parent 7312eb6c8b59f0cf047f44f7bf1b48051675e5fb [tests] Fix config.repository() in tests The config.repository was overriden too late. Closes #5778294 diff -r 7312eb6c8b59 -r daef7ce08fea devtools/__init__.py --- a/devtools/__init__.py Fri Oct 09 09:40:08 2015 +0200 +++ b/devtools/__init__.py Thu Jul 30 11:11:12 2015 +0200 @@ -401,6 +401,7 @@ from cubicweb.dbapi import in_memory_repo config._cubes = None repo = in_memory_repo(config) + config.repository = lambda x=None: repo # extending Repository class repo._has_started = False repo._needs_refresh = False diff -r 7312eb6c8b59 -r daef7ce08fea devtools/test/unittest_testlib.py --- a/devtools/test/unittest_testlib.py Fri Oct 09 09:40:08 2015 +0200 +++ b/devtools/test/unittest_testlib.py Thu Jul 30 11:11:12 2015 +0200 @@ -74,6 +74,16 @@ clean_repo_test_cls(MyWebTest) +class RepoInstancesConsistencyTC(CubicWebTC): + test_db_id = 'RepoInstancesConsistencyTC' + + def pre_setup_database(self, cnx, config): + self.assertIs(cnx.repo, config.repository()) + + def test_pre_setup(self): + pass + + HTML_PAGE = u""" need a title diff -r 7312eb6c8b59 -r daef7ce08fea devtools/testlib.py --- a/devtools/testlib.py Fri Oct 09 09:40:08 2015 +0200 +++ b/devtools/testlib.py Thu Jul 30 11:11:12 2015 +0200 @@ -428,7 +428,6 @@ self._admin_clt_cnx = repoapi.ClientConnection(self._admin_session) self._cnxs.add(self._admin_clt_cnx) self._admin_clt_cnx.__enter__() - self.config.repository = lambda x=None: self.repo # db api ##################################################################