Note that there are some explanatory texts on larger screens.

plurals
  1. POTests not being convered by 2to3 in setup.py?
    primarykey
    data
    text
    <p>I have a setup.py that needs to support both Python 2 and 3.</p> <p>The code currently works and is installable in Python 2.x</p> <p>If I add the <code>use_2to3 = True</code> clause to my setup.py, then the module can be <em>installed</em> in Python 3, however, doing a:</p> <pre><code>python setup.py test </code></pre> <p>Causes a failure as one of the tests uses the StringIO class, and the import line goofs in Python 3 (it's currently <code>from StringIO import StringIO</code>, where in Python3 it should be <code>from io import StringIO</code></p> <p>I thought though that once you add the use_2to3 keyword all tests (including unittests) were processed by 2to3 before being tested.</p> <p>What am I missing? In case it helps, the bulk of my setup.py looks like:</p> <pre><code>from setuptools import setup setup( name='myproject', version='1.0', description='My Cool project', classifiers = [ 'Programming Language :: Python', 'Programming Language :: Python :: 3', ], py_modules=['mymodule'], test_suite='test_mymodule', zip_safe=False, use_2to3 = True, ) </code></pre> <p>Edit: the reason I feel as though 2to3 isn't getting run on a <code>python setup.py test</code> is that it blows up &amp; the bottom of the stacktrace reads:</p> <pre><code>File "/home/aparkin/temp/mymodule/test_mymodule.py", line 18, in &lt;module&gt; from StringIO import StringIO </code></pre> <p>But if I ran 2to3 on test_mymodule.py, then that import line should've been reworked to:</p> <pre><code>from io import StringIO </code></pre> <p>And (at worst) the tests should just individually fail.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload