proper use of use_2to3 with Distribute's test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

proper use of use_2to3 with Distribute's test

Chris Jerdonek-3
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():

setup(name='pystache',
      ...
      packages=['pystache'],
      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
provide.

Thanks,
--Chris
_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig
Reply | Threaded
Open this post in threaded view
|

Re: proper use of use_2to3 with Distribute's test

Chris Jerdonek-3
On Fri, Apr 6, 2012 at 7:17 PM, Chris Jerdonek <[hidden email]> wrote:

> 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():
>
> setup(name='pystache',
>      ...
>      packages=['pystache'],
>      test_suite = 'tests',
> )

Sorry, this should have been the following (i.e. my call does include
the use_2to3 keyword)--

setup(name='pystache',
      ...
      packages=['pystache'],
      test_suite ='tests',
      use_2to3=True,
)

Modules in my package's "pystache" directory are copied/converted to a
directory called "build/lib/pystache", but not modules in my package's
"test" directory.

>
> It might be worth expanding the documentation in the link [1] above
> with the additional information that an answer to my question will
> provide.
>
> Thanks,
> --Chris
_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig