[TIP] Guidelines for where to put tests & how to package them

Olemis Lang olemis at gmail.com
Fri Feb 26 11:27:36 PST 2010


On Fri, Feb 26, 2010 at 1:58 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> On 25/02/2010 16:18, C. Titus Brown wrote:
>
> [snip...]
>
> And, when a setup.py is present (i.e. dev environment),
>
>   % python setup.py test
>
> is going to be the new standard in the brave new distutils2 world.
>
> Does that makes more sense as a backstore? ;)
>
> Your example for a setup.py shows the following:
>
>     test_suite='somepackage.tests.get_suite'
>
> Is test_suite a setuptools extension to distutils?

test_suite is ( supported | introduced | defined ) by
setuptools.comand.test.test class

> Is it required to be a
> callable

yep

> and will distutils2 use the same mechanism?

don't know

> If so then unittest(2)
> ought to have some support for it rather than being something that is *only*
> useable from setup.py.
>

Since I discovered the test command I realized that it collides with
unittest `suite` callable and now with the more recent discovery
protocol hooks ...

> Why not just:
>
>     tests='somepackage.tests'
>

Better explicit than implicit : what are `tests` ? test_suite is a test suite !

so IMHO -1

> Or even default to test discovery?
>

test command performs test discovery (as a last recourse AFAICR, /me
cc-ing to P.J. Eby because probably he has further updates ;o) using a
loader: setuptools.comand.test.xxx

BTW, I am strongly -1 for using the discovery protocol introduced in
2.7 (AFAICR), specially because it collides with test_suite and many
other arguments ... so it would be very nice when defining packaging
conventions, layout ... not to enforce the use of that protocol, so
that if another discovery is used then it could still be compatible
with the more abstract good practices. (all this said from my selfish
position, I confess)

> All the best,
>
> Michael Foord
>

PS: Sorry if not possible to distinguish where comments and replies start
:-/

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



More information about the testing-in-python mailing list