[web/test] use real_error_handling context manager instead of open-coding it
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 03 Apr 2014 16:05:54 +0200
changeset 9650 896b63873173
parent 9649 f89c2f127897
child 9651 c739ebc18b79
[web/test] use real_error_handling context manager instead of open-coding it
web/test/unittest_idownloadable.py
--- a/web/test/unittest_idownloadable.py	Thu Apr 03 16:03:19 2014 +0200
+++ b/web/test/unittest_idownloadable.py	Thu Apr 03 16:05:54 2014 +0200
@@ -21,7 +21,7 @@
 
 from logilab.common.testlib import unittest_main
 
-from cubicweb.devtools.testlib import CubicWebTC
+from cubicweb.devtools.testlib import CubicWebTC, real_error_handling
 from cubicweb import view
 from cubicweb.predicates import is_instance
 
@@ -136,11 +136,8 @@
         with self.admin_access.web_request() as req:
             req.form['vid'] = 'download'
             req.form['eid'] = str(req.execute('CWGroup X WHERE X name "managers"')[0][0])
-            errhdlr = self.app.__dict__.pop('error_handler') # temporarily restore error handler
-            try:
+            with real_error_handling(self.app):
                 data = self.app_handle_request(req)
-            finally:
-                self.app.error_handler = errhdlr
             get = req.headers_out.getRawHeaders
             self.assertEqual(['text/html;charset=UTF-8'],
                              get('content-type'))