[Distutils] proper use of use_2to3 with Distribute's test

Chris Jerdonek chris.jerdonek at gmail.com
Sat Apr 7 04:17:04 CEST 2012

I have a question regarding the proper use of the use_2to3 feature of
Distribute's test, as described here:

[1] http://packages.python.org/distribute/python3.html#distribute-as-help-during-porting

My tests run correctly under Python 2.7 when running the following:

    python setup.py test

However, when I switch to Python 3, I get a syntax error when running
this command.  The syntax error occurs in a module in a subdirectory
of my working directory called "tests".  Modules in this directory
don't seem to be converted to Python 3 when using the "use_2to3"
keyword argument.

When I manually convert everything to Python 3 using the following, I
am able to run unit tests without that same syntax error:

    2to3 --write --nobackups --no-diffs .

What is the proper way to tell setup() which files to convert to
Python 3?  Below is the relevant portion of my call to setup():

      test_suite = 'tests',

It might be worth expanding the documentation in the link [1] above
with the additional information that an answer to my question will


More information about the Distutils-SIG mailing list