Running DocTest on Strings

Paddy paddy3118 at netscape.net
Thu Jun 29 15:19:42 EDT 2006


notanotheridiot wrote:
> Hi,
> I have two strings - a docstring containing doctests and a code string
> containing code to be tested with those doctests. I've been trying for
> a day now to run the test without concatenating the two strings,
> adding:
>
> import doctest
> doctest.testmod
>
> to the bottom, writing it all to a file and executing it using popen().
>
> There must be some way of doing this without writing to a temporary
> file, any ideas?
>
> thanks in advance,
>
> johannes Woolard
Create the concatenated string then exec it?

- Pad.




More information about the Python-list mailing list