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

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


On Dec 18, 2010, at 04:24 AM, Marius Gedminas wrote:

>On Fri, Dec 17, 2010 at 05:26:47PM -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've a set of rules that serve me well.
>
>Rule #1: $VCS checkout and 'make test' should run the tests.  This means
>I've a Makefile that creates the virtualenv/bootstraps a buildout, with
>all my test dependencies, and then runs the actual test runner script
>(which may be setup.py test, or it may be something different).
>
>(Likewise, 'make run' should start a local copy of the application, if
>this is a runnable application.  But that's unrelated to testing.)

I think these are fine, but certainly with tests, I'd like 'make test' to be a
thin wrapper around 'setup.py test' *in the general case*.  Or IOW, I'd like
to see 'setup.py test' be an established standard convention for Python
packages.  Not required of course, but I do think most simple packages can
hook into it very easily, and should!

>FWIW I found this tests-against-build-dir behaviour mildly irritating,
>but mostly irrelevant: I always specify my own test suite loader in
>setup.py (for various reasons, e.g. doctests), and my test loader
>ignores build/ and uses the in-place tree.

I think the fundamental problem in our case is that these extra artifacts live
in-tree but are not in Python package directories.  They also aren't
installed, so we probably need to add rules to get these installed properly,
and then the auto-discovery would be able to find them without caring about
the build directories.  For now, I do some path hacking to get it working, but
it's an ugly solution.

>I tend to support 'python setup.py test' as a convenience for other
>people.  I dislike the copious build output it always produces at the
>beginning, and the time wasted to do the build.  This might change when
>I start paying more attention to Python 3.

A reduced output command would be useful, but I do like the interface a lot.
'python setup.py test' is nice and consistent, so IMO should be promoted as a
best practice.

-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/06875555/attachment.pgp>


More information about the Distutils-SIG mailing list