Hash: SHA1

On 27 Dec 2006, at 17:15, Martin Aspeli wrote:
From painful experience with the customer work right now, and from the work on the CMF branch to convert tools to utilities I'll add that they make debugging a lot harder (where can I step into and through the test code with pdb as I normally do?) and the fact that they don't just stop executing when an error is encountered like a normal unit test does. They continue, usually spewing miles and miles of text, and it's really annoying to scroll back screen after screen after screen to find the real problem.

I agree with the pdb problem. I tend to use them either to explain narratives about how code works, for functional tests with zope.testbrowser, and sometimes they just "feel" right for the thing to be tested, but I quickly came off using them for everything.

The testbrowser tests tend to be the worst when it comes to failures early on and then spewing out never-ending messages because the browser ist messed up at that point.

To only see the first test failure (it'll continue to execute regardless, because you may have cleanup code that needs to run after...) in the output, you can do this, which I always do:

import unittest
import doctest

from some.module import test_module

optionflags = doctest.REPORT_ONLY_FIRST_FAILURE | doctest.ELLIPSIS

def test_suite():
    suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(test_module, optionflags=optionflags))
    return suite

That's good to know, thanks. I'll try that out when I hit the next issue.


Version: GnuPG v1.4.5 (Darwin)

Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to