[Distutils] 'python setup.py test' in develop mode?

Barry Warsaw barry at python.org
Sat Dec 18 19:08:18 CET 2010


On Dec 18, 2010, at 04:49 AM, Arfrever Frehtes Taifersar Arahesis wrote:

>2010-12-18 00:16:52 P.J. Eby napisał(a):
>> At 05:26 PM 12/17/2010 -0500, Barry Warsaw wrote:
>> >Something bugs me about virtualenv, distribute, development, and testing.  I
>> >figure I'm probably doing something wrong and that y'all will be able to set
>> >me straight.
>> >
>> >I'm working on a new tool called pkgme[1].  It uses distribute and recommends
>> >using virtualenv for development.  After activating the virtualenv you can do
>> >'python setup.py develop' and do convenient in-place editing so that your
>> >changes to the source show up immediately in the running environment.  So far
>> >so good.
>> >
>> >However, when I want to run the test suite, it does the equivalent of a
>> >'python setup.py build' and then runs the tests out of the
>> >build/lib.{platform}-{version} directory.
>> 
>> Really?  That sounds wrong.  "python setup.py test" should run the 
>> tests against the *source* tree, with in-place extension builds.
>
>Modules are sometimes transformed by 2to3 during building (transformed
>versions are placed in build/lib*). Running tests (with Python 3) against the
>source tree would cause syntax errors etc.

Okay, I get that there are build-specific details that could cause problems
running the tests out of the source tree.  'setup.py develop' would have
similar problems, but that's much more of an isolated environment.  By that I
mean, it's mostly there for the developer while 'setup.py test' is a generic
interface that 3rd parties would use.  E.g. many Debian packages run 'setup.py
test' as part of the build process (and this against multiple versions of
Python, including 2.X and 3.X).

Still, it would be nice if there were a 'setup.py test --develop' mode or some
such.  Usually when I'm working on a package, I don't care about build
details, and I'm happy to do the moral equivalent of 'make clean' when I'm
doing testing with 2to3 and such.

In any case, thanks for pointing out that a 'setup.py test' using in-tree code
is not the default case, and wouldn't make sense to be the default.  I've
worked around the issue in our specific case.

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20101218/84d81490/attachment.pgp>


More information about the Distutils-SIG mailing list