doctest environment question

tag thomas.guest at gmail.com
Mon May 21 15:24:43 EDT 2007


On 21 May, 18:53, Peter Otten <__pete... at web.de> wrote:
> The doctest code is executed in a module without a __name__, it seems.
> Unfortunately (in this case) the builtin module serves as a fallback
> helping out with its own name:
>
> >>> __name__
> '__main__'
> >>> del __name__
> >>> __name__
>
> '__builtin__'
>
> What to do about it? doctest could be changed to execute code snippets in a
> module with a name and a sys.modules entry though I don't see much benefit
> here.

Peter, thanks for the quick response, but I don't quite understand
what you're saying. I don't want to change doctest -- I want to find a
way to make my example pass using doctest.

doctest.testfile comes with lots of parameters, and I suspect if I
knew how to do it I could pass in the correct parameters to make this
example work. It's not what I actually want to document/test, it's a
minimal example which demonstrates the problem.

Thanks again.
>
> Peter





More information about the Python-list mailing list