[Tutor] problems with doctest: apparent interferance between tests (LONG)

John Ridley ojokimu at yahoo.co.uk
Mon Apr 11 01:19:02 CEST 2005


 --- Brian van den Broek <bvande at po-box.mcgill.ca> wrote: 
> But: it still leaves me wondering why removing either a) the one-line
> no-doctest-containing docstring of the Wall_clock class or b) the
> unreferenced Wall_clock.stop_interval method made my original test
> code pass without needing to effect the changes you suggest. That
> seems really odd to me.

Hello again, Brian

Thought I'd better follow up on my previous post even though Kent has
already done a much better job than me of explaining things.

I believe your two remaining puzzles can be solved by trying this
little experiment. Using your original <culled code> example, add the
extra line that I suggested and then run the script with the -v
commandline option (i.e. python test.py -v).

What you should see is that the interval doctest is run first. But if
you comment out the 'no-doctest-containing docstring' and re-run the
script, the check_point doctest is run first! Needless to say, this
rather awkward side-effect is going to make it hard to ensure objects
are created and deleted at the right times ;-)

Now, I am not familiar enough with the doctest module to explain
exactly why this change in the 'running-order' should occur. But maybe
once you've begun to 'grok' doctest a little more you'll be able to
shed some light on it for us!

Regards

John Ridley

Send instant messages to your online friends http://uk.messenger.yahoo.com 


More information about the Tutor mailing list