devtools/testlib.py
changeset 5159 2543cfa5d54a
parent 5121 a63d7886fcf5
parent 5128 e5d300d75519
child 5174 78438ad513ca
equal deleted inserted replaced
5158:5e9055b8c10a 5159:2543cfa5d54a
   361     @contextmanager
   361     @contextmanager
   362     def temporary_appobjects(self, *appobjects):
   362     def temporary_appobjects(self, *appobjects):
   363         self.vreg._loadedmods.setdefault(self.__module__, {})
   363         self.vreg._loadedmods.setdefault(self.__module__, {})
   364         for obj in appobjects:
   364         for obj in appobjects:
   365             self.vreg.register(obj)
   365             self.vreg.register(obj)
   366         yield
   366         try:
   367         for obj in appobjects:
   367             yield
   368             self.vreg.unregister(obj)
   368         finally:
       
   369             for obj in appobjects:
       
   370                 self.vreg.unregister(obj)
   369 
   371 
   370     # vregistry inspection utilities ###########################################
   372     # vregistry inspection utilities ###########################################
   371 
   373 
   372     def pviews(self, req, rset):
   374     def pviews(self, req, rset):
   373         return sorted((a.__regid__, a.__class__)
   375         return sorted((a.__regid__, a.__class__)