[tests] Fix config.repository() in tests
The config.repository was overriden too late.
Closes #5778294
--- 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
--- 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"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head><title>need a title</title></head>
--- 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 ##################################################################