[test] skipping versions checking during test is enough, no need for monkey patch
--- a/devtools/testlib.py Wed Feb 24 11:48:24 2010 +0100
+++ b/devtools/testlib.py Wed Feb 24 11:52:11 2010 +0100
@@ -66,24 +66,7 @@
return set(schema.entities()) - protected_entities
-def get_versions(self, checkversions=False):
- """return the a dictionary containing cubes used by this instance
- as key with their version as value, including cubicweb version. This is a
- public method, not requiring a session id.
-
- replace Repository.get_versions by this method if you want to get versions
- from code instead of from the database
- """
- vcconf = {'cubicweb': self.config.cubicweb_version()}
- self.config.bootstrap_cubes()
- for pk in self.config.cubes():
- version = self.config.cube_version(pk)
- vcconf[pk] = version
- self.config._cubes = None
- return vcconf
-
-
-def refresh_repo(repo):
+def refresh_repo(repo, resetschema=False, resetvreg=False):
devtools.reset_test_database(repo.config)
for pool in repo.pools:
pool.reconnect()
--- a/hooks/test/unittest_hooks.py Wed Feb 24 11:48:24 2010 +0100
+++ b/hooks/test/unittest_hooks.py Wed Feb 24 11:52:11 2010 +0100
@@ -9,22 +9,8 @@
from datetime import datetime
-from cubicweb import (ConnectionError, ValidationError, AuthenticationError,
- BadConnectionId)
-from cubicweb.devtools.testlib import CubicWebTC, get_versions
-
-from cubicweb.server.sqlutils import SQL_PREFIX
-from cubicweb.server.repository import Repository
-
-orig_get_versions = Repository.get_versions
-
-def setup_module(*args):
- Repository.get_versions = get_versions
-
-def teardown_module(*args):
- Repository.get_versions = orig_get_versions
-
-
+from cubicweb import ValidationError, AuthenticationError, BadConnectionId
+from cubicweb.devtools.testlib import CubicWebTC
class CoreHooksTC(CubicWebTC):
--- a/hooks/test/unittest_syncschema.py Wed Feb 24 11:48:24 2010 +0100
+++ b/hooks/test/unittest_syncschema.py Wed Feb 24 11:52:11 2010 +0100
@@ -1,31 +1,11 @@
from logilab.common.testlib import TestCase, unittest_main
-from cubicweb.devtools.testlib import CubicWebTC
-#################
-# <required ?> #
-#################
+from cubicweb import ValidationError
+from cubicweb.devtools.testlib import CubicWebTC
+from cubicweb.server.sqlutils import SQL_PREFIX
-from datetime import datetime
-
-from cubicweb import (ConnectionError, ValidationError, AuthenticationError,
- BadConnectionId)
-from cubicweb.devtools.testlib import get_versions
-
-from cubicweb.server.sqlutils import SQL_PREFIX
-from cubicweb.server.repository import Repository
-
-orig_get_versions = Repository.get_versions
-#################
-# </required ?> #
-#################
-
-def setup_module(*args):
- Repository.get_versions = get_versions
-
-def teardown_module(*args):
- Repository.get_versions = orig_get_versions
-
+SCHEMA_EIDS = {}
class SchemaModificationHooksTC(CubicWebTC):
@classmethod
--- a/server/repository.py Wed Feb 24 11:48:24 2010 +0100
+++ b/server/repository.py Wed Feb 24 11:52:11 2010 +0100
@@ -447,7 +447,8 @@
public method, not requiring a session id.
"""
versions = self.get_versions(not (self.config.creating
- or self.config.repairing))
+ or self.config.repairing
+ or self.config.mode == 'test'))
cubes = list(versions)
cubes.remove('cubicweb')
return cubes
--- a/server/test/unittest_migractions.py Wed Feb 24 11:48:24 2010 +0100
+++ b/server/test/unittest_migractions.py Wed Feb 24 11:52:11 2010 +0100
@@ -9,20 +9,11 @@
from logilab.common.testlib import TestCase, unittest_main
from cubicweb import ConfigurationError
-from cubicweb.devtools.testlib import CubicWebTC, get_versions
+from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.schema import CubicWebSchemaLoader
from cubicweb.server.sqlutils import SQL_PREFIX
-from cubicweb.server.repository import Repository
from cubicweb.server.migractions import *
-orig_get_versions = Repository.get_versions
-
-def setup_module(*args):
- Repository.get_versions = get_versions
-
-def teardown_module(*args):
- Repository.get_versions = orig_get_versions
-
class MigrationCommandsTC(CubicWebTC):