Evolving doctests for changing output format

nriley at gmail.com nriley at gmail.com
Tue Jan 9 04:31:56 CET 2007


I've got a number of doctests which rely on a certain output format,
and since I wrote the tests I've changed the output format.  Now,
almost all the tests fail.

What I'd like is if I could get doctest to take my tests, and
substitute the obtained output for the provided output.  Then, I could
in this case just replace the doctest file with the generated file, or
in general be able to run it through a file comparison tool so I could
examine the differences.

If it's not clear from the above, here's an example, assuming for the
sake of simplicity that Python somehow changed its default output base
between runs.

>> 10 + 10

>> 10 + 10

Is it possible to use doctest in such a "run-only" mode, or script the
above using its API?  I read the documentation several times but just
got further confused (sorry!).



More information about the Python-list mailing list