cwvreg.py
branchstable
changeset 4996 45ce27d538a1
parent 4966 e968e0a7776b
child 5035 8469d0acd949
--- a/cwvreg.py	Wed Mar 24 15:08:24 2010 +0100
+++ b/cwvreg.py	Wed Mar 24 15:09:21 2010 +0100
@@ -22,12 +22,6 @@
 from cubicweb.rtags import RTAGS
 
 
-@onevent('before-registry-reload')
-def clear_rtag_objects():
-    for rtag in RTAGS:
-        rtag.clear()
-
-
 def use_interfaces(obj):
     """return interfaces used by the given object by searching for implements
     selectors, with a bw compat fallback to accepts_interfaces attribute
@@ -265,6 +259,13 @@
         self.schema = None
         self.initialized = False
         self.reset()
+        if self.config.mode != 'test':
+            # don't clear rtags during test, this may cause breakage with
+            # manually imported appobject modules
+            @onevent('before-registry-reload')
+            def clear_rtag_objects():
+                for rtag in RTAGS:
+                    rtag.clear()
 
     def setdefault(self, regid):
         try: