doctest not seeing any of my doc tests

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Sep 7 18:59:48 EDT 2008


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):
>        import doctest, yourmodule
>        doctest.testmod(yourmodule, verbose=verbose)
> 
> (where yourmodule is the name of your module, obviously)



Well, that certainly fixed the problem, thanks. It now correctly runs all 
my doctests.

But I don't understand why a bare doctest.testmod() works when you run it 
non-interactively, but fails when run interactively.



-- 
Steven



More information about the Python-list mailing list