[testlib] provide ability to control schema/vreg reset using reset_schema/reset_vreg test class attributes stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Feb 2010 11:53:36 +0100
branchstable
changeset 4690 0cfb6b63f90b
parent 4689 4eb1f4490538
child 4691 ae468fae9965
[testlib] provide ability to control schema/vreg reset using reset_schema/reset_vreg test class attributes
devtools/testlib.py
--- a/devtools/testlib.py	Wed Feb 24 11:52:11 2010 +0100
+++ b/devtools/testlib.py	Wed Feb 24 11:53:36 2010 +0100
@@ -75,6 +75,8 @@
     repo.querier._rql_cache = {}
     for source in repo.sources:
         source.reset_caches()
+    if resetschema:
+        repo.set_schema(repo.config.load_schema(), resetvreg=resetvreg)
 
 
 # email handling, to test emails sent by an application ########################
@@ -143,6 +145,7 @@
     """
     appid = 'data'
     configcls = devtools.ApptestConfiguration
+    reset_schema = reset_vreg = False # reset schema / vreg between tests
 
     @classproperty
     def config(cls):
@@ -213,7 +216,7 @@
 
     @classmethod
     def _refresh_repo(cls):
-        refresh_repo(cls.repo)
+        refresh_repo(cls.repo, cls.reset_schema, cls.reset_vreg)
 
     # global resources accessors ###############################################