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

Felix Schwarz felix.schwarz at agile42.com
Wed Jul 28 00:48:36 PDT 2010


Am 28.07.2010 03:13, schrieb Andrew Bennetts:
> Do you provide a foolib-tests (or maybe foolib-dev) binary package
> alongside the foolib package?  Or provide a public foolib.test_support
> module that has all the bits you expect others to need?   [They both
> seem like plausible answers to me, but I'm curious to hear if someone
> has experience with these approaches.]

That's somehow how I usually do it for smaller projects (<10k LOC):

mypackage/...
mypackage/test
   contains testing infrastructure, helpers, ...
tests/
   all tests (usually just unit tests/component tests, no need for
   big setups, opening a browser etc)

Reasoning:
- Test infrastructure might be part of the public API even.
- I want to run my tests against the deployed version (e.g. zipped egg
   file) on my build servers so I put it separately (so I can run the
   tests easily with nosetests and custom test runners which require to
   have tests in real files)

fs



More information about the testing-in-python mailing list