[Distutils] Where should I put tests when packaging python modules?

Donald Stufft donald at stufft.io
Tue Oct 6 13:07:31 CEST 2015



On October 6, 2015 at 7:00:41 AM, Antoine Pitrou (solipsis at pitrou.net) wrote:
> On Tue, 6 Oct 2015 11:30:00 +0300
> Ionel Cristian Mărieș wrote:
> > On Tue, Oct 6, 2015 at 10:51 AM, Antoine Pitrou wrote:
> >
> > > They should be inside the module. That way, you can check an installed
> > > module is ok by running e.g. "python -m mypackage.tests". Any other
> > > choice makes testing installed modules more cumbersome.
> > >
> >
> > ​Does that really make sense? I haven't heard of any user actually running
> > tests
> > that way. To be honest I haven't ever ran Python's own tests suite as part
> > of a user installation.
>  
> There are several situations besides the "downstream packagers" use case
> mentioned somewhere else:
>  
> * One of your users report a weird issue, you can ask them to run the
> test suite on their installation to check that nominal behaviour of
> the package is ok on their machine. If you don't ship the test suite,
> you have to ask them to do extra manual steps in order to do this
> verification, which can be cumbersome and delay proper response to
> the issue.

I've never, in my entire life, been asked to run someone's test suite to
validate a bug nor have I asked someone to run a test suite to validate a bug.
This is still ignoring the problems of test dependencies as well so you'll
still need to ask them to install some number of dependencies, and I think it's
fairly trivial to ask someone to download a tarball, untar it, and run two
commands.

>  
> * Your package requires non-Python data files for proper functioning,
> and you want to check the installation procedure puts them in the
> right place. The natural way to do that is to run the test suite on
> the installed package.

You're confusing "ships the test suite as part of the package" with "runs the
test suite on the installed package". The two aren't really related, you can
run the tests against an installed package trivially in either situation.

>  
> Really, "ship the test suite" should be the norm and not shipping it
> should be the exception (if e.g. testing needs large data files).
>  
> Regards
>  
> Antoine.
> _______________________________________________
> Distutils-SIG maillist - Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>  

-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA




More information about the Distutils-SIG mailing list