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

Ben Finney ben+python at benfinney.id.au
Tue Oct 6 11:18:03 CEST 2015


Ionel Cristian Mărieș <contact at ionelmc.ro> writes:

> I've seen some projects that lump up lots of test data and crazy files
> in their packages tests and that created install issues.
>
> On the other hand, if the user really wants to run the tests he can
> just get the sources (that would naturally include everything)?

Yes, this is a sensible approach:

* The source package contains all the source files a developer would use
  to make further changes and test them.

* The package for installation contains only those files useful run-time
  users, plus metadata (e.g. copyright information).

I highly recommend it, and I would like the PyPA to also recommend the
above approach.

It does, though, require the acknowledgement of a separate *build* step
in the development-and-release process. The build step is prior to the
packaging step, and it generates run-time files from the collection of
source files.

That separation of a discrete build step is crucial for many good
practices: generate documentation, integration testing, OS packaging,
etc.

-- 
 \        “The restriction of knowledge to an elite group destroys the |
  `\                   spirit of society and leads to its intellectual |
_o__)                                impoverishment.” —Albert Einstein |
Ben Finney



More information about the Distutils-SIG mailing list