devtools/testlib.py
branchstable
changeset 7879 9aae456abab5
parent 7815 2a164a9cf81c
child 7894 ad0eeb0f7a8d
--- a/devtools/testlib.py	Tue Sep 27 16:04:30 2011 +0200
+++ b/devtools/testlib.py	Wed Sep 28 09:27:42 2011 +0200
@@ -1167,34 +1167,34 @@
         pass
 
 
-def vreg_instrumentize(testclass):
-    # XXX broken
-    from cubicweb.devtools.apptest import TestEnvironment
-    env = testclass._env = TestEnvironment('data', configcls=testclass.configcls)
-    for reg in env.vreg.values():
-        reg._selected = {}
-        try:
-            orig_select_best = reg.__class__.__orig_select_best
-        except Exception:
-            orig_select_best = reg.__class__._select_best
-        def instr_select_best(self, *args, **kwargs):
-            selected = orig_select_best(self, *args, **kwargs)
-            try:
-                self._selected[selected.__class__] += 1
-            except KeyError:
-                self._selected[selected.__class__] = 1
-            except AttributeError:
-                pass # occurs on reg used to restore database
-            return selected
-        reg.__class__._select_best = instr_select_best
-        reg.__class__.__orig_select_best = orig_select_best
+# def vreg_instrumentize(testclass):
+#     # XXX broken
+#     from cubicweb.devtools.apptest import TestEnvironment
+#     env = testclass._env = TestEnvironment('data', configcls=testclass.configcls)
+#     for reg in env.vreg.values():
+#         reg._selected = {}
+#         try:
+#             orig_select_best = reg.__class__.__orig_select_best
+#         except Exception:
+#             orig_select_best = reg.__class__._select_best
+#         def instr_select_best(self, *args, **kwargs):
+#             selected = orig_select_best(self, *args, **kwargs)
+#             try:
+#                 self._selected[selected.__class__] += 1
+#             except KeyError:
+#                 self._selected[selected.__class__] = 1
+#             except AttributeError:
+#                 pass # occurs on reg used to restore database
+#             return selected
+#         reg.__class__._select_best = instr_select_best
+#         reg.__class__.__orig_select_best = orig_select_best
 
 
-def print_untested_objects(testclass, skipregs=('hooks', 'etypes')):
-    for regname, reg in testclass._env.vreg.iteritems():
-        if regname in skipregs:
-            continue
-        for appobjects in reg.itervalues():
-            for appobject in appobjects:
-                if not reg._selected.get(appobject):
-                    print 'not tested', regname, appobject
+# def print_untested_objects(testclass, skipregs=('hooks', 'etypes')):
+#     for regname, reg in testclass._env.vreg.iteritems():
+#         if regname in skipregs:
+#             continue
+#         for appobjects in reg.itervalues():
+#             for appobject in appobjects:
+#                 if not reg._selected.get(appobject):
+#                     print 'not tested', regname, appobject