devtools/testlib.py
changeset 2668 979c7ccb4a86
parent 2657 de974465d381
child 2770 356e9d7c356d
child 2773 b2530e3e0afb
child 3226 10f4f525044c
--- a/devtools/testlib.py	Mon Aug 03 17:59:34 2009 +0200
+++ b/devtools/testlib.py	Tue Aug 04 00:51:00 2009 +0200
@@ -389,7 +389,10 @@
                                            requestcls=testclass.requestcls)
     for reg in env.vreg.values():
         reg._selected = {}
-        orig_select_best = reg.__class__.select_best
+        try:
+            orig_select_best = reg.__class__.__orig_select_best
+        except:
+            orig_select_best = reg.__class__.select_best
         def instr_select_best(self, *args, **kwargs):
             selected = orig_select_best(self, *args, **kwargs)
             try:
@@ -400,6 +403,7 @@
                 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():