On Sun, 07 Sep 2008 15:51:01 +0200, Fredrik Lundh wrote:
> Steven D'Aprano wrote:
>
>> I have a function in my module:
>>
>> def selftest(verbose=False):
>> import doctest
>> doctest.testmod(verbose=verbose)
>
> what happens if you change the above to
>
>def selftest(verbose=False)
Steven D'Aprano, first of all you can try to run a minimal module, to
see if your doctesting works, like:
"""
>>> 1 + 1
3
"""
def foo():
"""
>>> foo()
1
"""
return 0
import doctest
doctest.testmod()
If that works correctly, then you can show us some more of the code
and tests.
Steven D'Aprano wrote:
I have a function in my module:
def selftest(verbose=False):
import doctest
doctest.testmod(verbose=verbose)
what happens if you change the above to
def selftest(verbose=False):
import doctest, yourmodule
doctest.testmod(yourmodule, verbose=verbos
I have a function in my module:
def selftest(verbose=False):
import doctest
doctest.testmod(verbose=verbose)
When I run it, it fails to find any of my doc tests, including the tests
in __main__, and in fact it looks like it can't even find my functions
and classes:
>>> mymodule.selft