[Zope-CMF] Re: Zope 3 events from workflow

Tres Seaver tseaver at palladion.com
Wed Dec 27 11:35:55 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Aspeli wrote:
> Jens Vagelpohl wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>>
>> On 27 Dec 2006, at 16:16, Tres Seaver wrote:
>>> Rocky Burt wrote:
>>>> On Wed, 2006-27-12 at 11:46 +0100, Jens Vagelpohl wrote:
>>>>> P.S.: I _hate hate hate_ doctests ;)
>>>> Why?
>>> I won't speak for Jens, but I find they have two serious drawbacks when
>>> used as *unit tests* (as opposted to quasi-functional tests with 
>>> narrative):
>>>
>>>   - Tests dont run in isolation from one another (this is why I say
>>>     quasi-functional).
>>>
>>>   - The contortions required to get testable output printed often
>>>     obscure the intent of the test itself.
>>  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 tend to run with 'bin/zopectl test -D' to stop the test in
"postmortem" mode at the first failure:  works for both "traditional"
unit tests and doctests.

> 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.
> 
> 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

Cool, I didn't know that one.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFkqDq+gerLs4ltQ4RAh3+AKC2JXtIUNlswbZrgr77ybh0HKVzBgCfcfss
7VFQGAv+bXIoCftlEOzPHvY=
=NpGM
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list