[TIP] including (or not) tests within your package

Ben Finney ben+python at benfinney.id.au
Mon Jul 26 20:32:20 PDT 2010

Alfredo Deza <alfredodeza at gmail.com> writes:

> What do you guys feel about including the test directory within your
> package so it is included at the time of installation?
> I'm gearing towards including them, but wanted to hear your opinion
> about it.

Definitely. Anyone who wants to change the source will benefit from
having the automated tests, to make sure their changes didn't cause any
regressions from tested behaviour. I get sad when I download a source
package and get no automated tests; I get infuriated when I later
discover the tests exist, but were not packaged with the source.

The trick then becomes management of the build script so that the
install step does *not* deploy the tests. Which requires thinking of
one's package as a package to be deployed, even though you're deploying
it in source form. From that point, it's a matter of learning about
Distutils and all the rest.

 \     “Oh, I realize it's a penny here and a penny there, but look at |
  `\      me: I've worked myself up from nothing to a state of extreme |
_o__)                                          poverty.” —Groucho Marx |
Ben Finney

More information about the testing-in-python mailing list