merge stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 31 Mar 2010 14:32:19 +0200
branchstable
changeset 5114 55b8b7a5bc4a
parent 5113 f8cbdb51e6d4 (current diff)
parent 5109 5cf83b9356d5 (diff)
child 5115 2e43ef618d14
merge
--- a/server/test/unittest_storage.py	Wed Mar 31 14:32:07 2010 +0200
+++ b/server/test/unittest_storage.py	Wed Mar 31 14:32:19 2010 +0200
@@ -6,6 +6,8 @@
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
 
+from __future__ import with_statement
+
 from logilab.common.testlib import unittest_main
 from cubicweb.devtools.testlib import CubicWebTC
 
@@ -93,14 +95,8 @@
         self.assertEquals(fspath.getvalue(), '/the/path')
 
     def test_source_storage_transparency(self):
-        self.vreg._loadedmods[__name__] = {}
-        self.vreg.register(DummyBeforeHook)
-        self.vreg.register(DummyAfterHook)
-        try:
+        with self.temporary_appobjects(DummyBeforeHook, DummyAfterHook):
             self.create_file()
-        finally:
-            self.vreg.unregister(DummyBeforeHook)
-            self.vreg.unregister(DummyAfterHook)
 
     def test_source_mapped_attribute_error_cases(self):
         ex = self.assertRaises(QueryError, self.execute,