[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()
     >>> fun() is None
     return foo

def _test():
     import doctest

if __name__ == "__main__":

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


More information about the wingide-users mailing list