I'm using zope.testbrowser to test a pyramid application I'm working on.
I'd really like to get the Browser.handleErrors knob working.
zope.testbrowser puts two variables into the WSGI envronment to try get
the application it's testing to throw rather than catch errors:
if not handle_errors:
# There doesn't seem to be a "Right Way" to do this
extra_environ['wsgi.handleErrors'] = False # zope.app.wsgi does this
extra_environ['paste.throw_errors'] = True # the paste way of doing this
Perhaps it's as simple as putting this in pyramid/router.py:
if not environ.get('wsgi.handleErrors', True):
raise
But I'm guessing not. Any advice before I start working up a patch?
--
Brian Sutherland
On Tue, May 24, 2011 at 6:48 PM, Brian Sutherland
<br...@vanguardistas.net> wrote:
>
> But I'm guessing not. Any advice before I start working up a patch?
>
Use WebTest ? Just a thought. Maybe you really want to use zope.testbrowser.
--
Gael
> --
> Brian Sutherland
>
> --
> You received this message because you are subscribed to the Google Groups "pylons-devel" group.
> To post to this group, send email to pylons...@googlegroups.com.
> To unsubscribe from this group, send email to pylons-devel...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.
>
>
Same question really. How do I ask, with WebTest, for the error not to
be caught?
http://pythonpaste.org/webtest/#framework-hooks mentions "paste.throw_errors".
--
Brian Sutherland
I'm not sure what you mean exactly, but have you tried setting
browser.raiseHttpErrors = False ?
Wichert.
--
Wichert Akkerman <wic...@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
raiseHttpErrors is slightly different from handleErrors and doesn't
require any help from the WSGI application under test:
http://pypi.python.org/pypi/zope.testbrowser#handling-errors
I mostly use handleErrors to quickly debug test failures. i.e. when an
exception is raised inside a view but then converted to a nicely
formatted error page by a bare try/except.
In that case you want to quickly see the exception rather than the HTML
error page.
The specific bare try/except bothering me in this case is in
pyramid.router.Router.__call__.
--
Brian Sutherland