[Zope3-dev] Patching zope.testing

Gustavo Niemeyer gustavo at niemeyer.net
Tue Sep 5 13:51:57 EDT 2006


Hello Fred,

> We're certainly using the zope.testing framework for internal
> projects; I expect a number of projects would be affected.
> 
> In thinking about this, it's not at all clear to me that this is the
> "right" thing to do.  When checking logging output, what's really
> being checked is that a usable log entry is being made at the right
> level.  If what you want is to test an exception, that seems to be a
> distinct test (IMO, of course).

Perhaps.  My real intention with the change was making it easier to
detect what went wrong when an exception happens.  So, for instance,
if you have a doctest that says something like:

  >>> do_something(request)
  some.logger DEBUG
    Processing foo bar.

And you get an error like:

  >>> do_something(request)
  some.logger ERROR
    Something bad happened.

You'll have to dig after what's wrong and why the error happened. If
instead it said:

  >>> do_something(request)
  some.logger ERROR
    Something bad happened.
    <traceback>

There's a good chance that you could tell what the problem is without
looking further.

In any case, I imagined it'd be an improvement, but decided to check
because it could cause some pain.  If it the trouble isn't worth the
improvement, we can of course stick it in our own code base.

-- 
Gustavo Niemeyer
http://niemeyer.net


More information about the Zope3-dev mailing list