On Sep 12, 2011, at 12:17 PM, Joey Hess wrote:

>How standard? Ie, I picked a random python package,aand:
>
>joey@gnu:~/tmp/python-mpd-0.3.0>python setup.py test
>usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
>   or: setup.py --help [cmd1 cmd2 ...]
>   or: setup.py --help-commands
>   or: setup.py cmd --help
>
>error: invalid command 'test'

Right, setuptools/distutils supports it by default, though it requires a
`test_suite` parameter in setup().

>So I picked another one:
>
>joey@gnu:~/tmp/jabber.py-0.5.0>python setup.py test
>usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
>   or: setup.py --help [cmd1 cmd2 ...]
>   or: setup.py --help-commands
>   or: setup.py cmd --help
>
>error: invalid command 'test'
>
>So I tried one more:
>
>joey@gnu:~/tmp/python-memcache-1.47>python setup.py test 
>running test
>
>Well, finally. (Not much of a test suite tho.) 
>
>Perhaps you meant to say that's the standard for a python package
>that uses setuptools, rather than distutils? Or something more
>complicated.

It'll also be supported by default in `packaging` (for >=Python 3.3) and
distutils2 for older Pythons.  I've been trying to push for this cli as the
standard for Python modules, and I think it's gaining some traction.  It'll
gain more momentum once packaging/distutils2 is more widespread I think.
Since there currently *is* no standard for Python libraries, I think this one
makes the most sense.

http://lists.idyll.org/pipermail/testing-in-python/2010-February/002659.html

>> dh_auto_test should support this for Python packages.  It might also
>> make sense to use this in preference to running 'make check' even if
>> there is a Makefile present.
>
>FWIW, dh_auto_test never runs make test/check on python packages.

Ah, so it's only if there's a Makefile present, regardless of whether it's a
Python package, that `make test` gets run.  Ideally, once dh_auto_test knows
about `python setup.py test`, even if there's a Makefile it would run setup.py
first, possibly with some additional logic to check if the setup supports it
or not (grep'ing for `test_suite` might be an easy check).

Cheers,
-Barry

P.S. try flufl.enum for a package that supports it.  Take a look at
debian/rules for the ickiness I had to add to make it work. ;)

Attachment: signature.asc
Description: PGP signature

Reply via email to