[Distutils] Problem with distribute and converting tests for python3

Lennart Regebro regebro at gmail.com
Sun Oct 11 22:43:07 CEST 2009


2009/10/11 Michael Whapples <mwhapples at aim.com>:
> Hello,
> Firstly thanks to those working on distribute, I had been using setuptools
> but was getting annoyed with it slowly developing (eg. not having python3
> support, etc), so distribute seems like it is what I am looking for.
>
> Any way I am using distribute for one of my packages now (I wanted to try
> and support python3) but have noticed something which doesn't work for me. I
> have my main package sources in one directory and then tests in another
> directory (it makes it easy to separate them out when creating a binary
> package). Now this works fine for python2.x as I can include the tests in a
> source distribution by using MANIFEST.in, but it doesn't work for python3 as
> distribute doesn't seem to run 2to3 on them (although they are run by the
> distribute/setuptools test command in the setup.py script).

You have to tell setup that these files are source files, somehow. By
just including them in MANIFEST.in but not in any source package
they'll get treated  as resources. Perhaps if you included it as a
apckage or py_module?

It is true that Distribute picks up files in test/test*.py for
inclusion in source distributions, which I didn't know until now.
These will not be included in the binary distribution, and hence not
converted with 2to3 either, so that will not work with 2to3 support.
That needs to be documented or fixed somehow, although I don't really
know how...

> If I were to
> structure my source distribution like the distribute example then how do I
> ensure unit tests aren't included in a binary distribution?

Well... what is the actual use case for doing that? There's no problem
with distributing the tests (in fact, I would say it's a good idea).

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64


More information about the Distutils-SIG mailing list