[Zope-dev] zope.testing.doctest bug

Chris Withers chris at simplistix.co.uk
Thu Aug 28 06:35:09 EDT 2008


Hi All,

Here's an example from a python interpretter session:

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> def test():
...   print "hello"
...   raise Exception()
...
 >>> test()
hello
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "<stdin>", line 3, in test
Exception

...which doesn't behave the same as a doctest:

Failed example:
     test()
Exception raised:
     Traceback (most recent call last):
       File "zope.testing-3.6.0-py2.4.egg\zope\te
sting\doctest.py", line 1356, in __run

       File "<doctest readme.txt[8]>", line 1, in ?
         test()
       File "<doctest readme.txt[7]>", line 3, in test
         raise Exception()
     Exception

The problem is that the function prints output before raising the 
exception. If I take the printed output away, the doctest passes fine.
However, especially with dumym fixtures common in doctests, that printed 
output needs to be seen to test that things are happening as they should 
prior to the exception being raised.

Where should I log this bug?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-Dev mailing list