Hi Steven,
On 2010-09-05 17:30, Steven D'Aprano wrote:
> I run the doctests with:
>
> python2.6 -m doctest examples.txt
>
> and the first example passes, but the second fails with NameError:
> make_spam not defined.
I run my doctests by calling
doctest.testfile(filename)
for each file in a loop. This way, names and their
associated objects survice from one code block to the next.
I just read that the way you use doctest should behave the
same, according to the documentation. In case of a text file
I just tested, it does; all tests pass despite the text
snippets between the code blocks.
What do you get if you test your text file by explicitly
calling doctest.testfile?
Stefan
--
http://mail.python.org/mailman/listinfo/python-list