[TIP] Where to put unit tests? (What to name subdirectory?)

Chris Lasher chris.lasher at gmail.com
Wed Dec 17 21:52:17 PST 2008

On Wed, Nov 12, 2008 at 3:58 PM, Kumar McMillan <kumar.mcmillan at gmail.com>wrote:

> 2. put all tests within your package.  So if your package is
> foo/__init__.py you would have a directory like foo/tests/__init__.py,
> foo/tests/test_utils.py, etc.  They will get deployed via python
> setup.py install

What's the best way to import the module whose fixtures you want to test
using this model, where your test module is in the tests/ subdirectory
(pkg/tests/foo_tests.py), and the module is in the root directory
(pkg/foo.py)? How do you put the the modules on sys.path for the tests, and
make it work any way (e.g., if you're using setup.py to call out your
tests)? Anyone care to point to code that uses this layout so we can get an
example of how this is used in practice?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20081218/ad1801ab/attachment.htm 

More information about the testing-in-python mailing list