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

Antoine Pitrou solipsis at pitrou.net
Tue Oct 6 10:44:15 CEST 2015


On Tue, 6 Oct 2015 09:17:22 +0100
Paul Moore <p.f.moore at gmail.com> wrote:
> On 6 October 2015 at 08:51, Antoine Pitrou <solipsis at pitrou.net> 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.
> 
> One inconvenience with this is that if you use an external testing
> framework like nose or pytest, you either need to make your project
> depend on it, or you need to document that "python -m mypackage.tests"
> has additional dependencies that are not installed by default.
> 
> With an external tests directory, the testing framework is just
> another "development requirement".

Doesn't / didn't setuptools have something called test_requires?

> It would also be very easy to take the view that the PyPA sample
> project should omit the test directory altogether, as it's a sample
> for the *packaging* guide, and development processes like testing are
> out of scope (that's why we don't include a documentation directory,
> or recommend sphinx, for example).

That sounds like the best course to me.

Regards

Antoine.


More information about the Distutils-SIG mailing list