[Python-3000] doctest portability

Stefan Behnel stefan_ml at behnel.de
Sat May 31 17:47:06 CEST 2008


Georg Brandl wrote:
> Stefan Behnel schrieb:
>> I know, I could use the lib2to3 package, but it a) is a one-way tool
>> in the
>> wrong direction if you have to distinguish bytes/str literals, b) lacks
>> configurability stating exactly what changes need to be done and c)
>> seemed
>> harder to set up for doctests than doing the conversion by hand.
> 
> Shouldn't the -d option handle doctests without further set-up?

If you start 2to3 from the command prompt to convert the files that contain
the doctests and copy them to a new location, then yes. But the question is:
how do you run a Py2 doctest in Py3 without first copying your doctests or
doctest containing sources to new files and then running the tests from there?
You can't require people to put such a work-around into every test script in
the world. Adding an option, fine. Copying files, adapting paths and all that,
why?

Stefan



More information about the Python-3000 mailing list