[Twisted-Python] Refactoring of trial - call for feature requests and suggestions
Christopher Armstrong
radix at twistedmatrix.com
Fri Jun 18 09:13:50 EDT 2004
slyphon at twistedmatrix.com wrote:
> I am undertaking the refactoring of trial and i'm looking for
> suggestions as to what features people think trial lacks, what they'd
> like it to do that it never did, and so on.
Here's one: the log / trial interaction sucks (which, gulp, I wrote --
but hey, this was ancient history before log.py improved :). Trial sets
things up so that when log.err() occurs, it raises an error -- which is
reasonable, but the way you have to handle that error, and the way it's
implemented, is pretty lame.
It should be refactored to use a log observer, not special code in
log.py (ignoreErrors, flushErrors, clearIgnores, and part of err).
I just wrote a test case yesterday that looks like this:
# ergh, trial/log interaction kind of sucks
log.ignoreErrors(BoomErr)
try:
doSomethingWhichEventuallyLogErrs()
finally:
log.clearIgnores()
I think clearIgnores should be called by the post-test cleanup code in
trial. In addition, the error that's printed when you FORGET to
ignoreErrors should make it obvious that it's because trial considers
log.err() to be an error: It took me a few minutes of profound boggling
after looking at the traceback, and then the code, which looked like
try:
foo()
except:
log.err()
return None
And the traceback pointing at the line foo() is called on. Which is
reasonable; that's the traceback log.err() prints. It just needs to be
more obvious what's going on, and that I should, perhaps, add an
ignoreErrors call to my test case (or fix a bug).
--
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
---------+ http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040618/12e14bd1/attachment.pgp
More information about the Twisted-Python
mailing list