[wingide-users] Global is None in doctest in function
René Pijlman
reneOnLists at applinet.nl
Thu May 8 14:32:26 MDT 2008
I just installed 3.1.0-1 with Python 2.4.4 on Windows XP. Doctests seem
to have improved, but we're not quite there yet :-/
I have a bunch of files with doctests that work fine when I execute the
files in Wing and watch the debug I/O, but fail when I run the tests in
the testing tool. It looks like the common pattern is a module global
that's used in a function. For example:
foo = 'bar'
def fun():
"""
>>> fun()
'bar'
>>> fun() is None
False
"""
return foo
def _test():
import doctest
doctest.testmod()
if __name__ == "__main__":
_test()
These two doctest examples run fine when I execute the file, but in the
testing tool the first example fails without explanation or output, and
the second example fails with 'Output: True'. It seems that foo is None
in the execution context of the tests in fun().
--
René
More information about the wingide-users
mailing list