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

Daryl Spitzer daryl.spitzer at gmail.com
Wed Nov 12 13:05:43 PST 2008

> What are the disadvantages?

There is no clear distinction between different types of tests (unit
vs. integration, etc.).

Though Cosmin Stejerean tweeted
(http://twitter.com/offbytwo/status/1002689003) that "if you use nose
and have a tests/integration/ folder with no __init__.py you can run
them selectively using -i integration"


On Wed, Nov 12, 2008 at 12:55 PM, Aaron Maxwell <amax at redsymbol.net> wrote:
> On Wednesday 12 November 2008 12:41:14 Daryl Spitzer wrote:
>> Is there a convention for where to put unit tests?
>> I favor putting them in a subdirectory named "UnitTests" (following
>> But a colleague states that the python stdlib's tests are in a
>> subdirectory called "tests".
> I personally usually use "tests".  It does not much matter though, if whatever
> mechanism you have for running tests and reporting results supports it.
> Another data point: Django also uses "tests" as a convention for websites and
> apps built using it.  (More specifically,  the django test-running utility
> assumes that tests are in a module named "tests", whether that's a tests.py
> file, or a directory named tests that contains an __init__.py file.)
>> Should I consider that a convention and
>> stick with it (in spite of its disadvantages)?
> What are the disadvantages?
> --
> Aaron Maxwell
> http://redsymbol.net/

More information about the testing-in-python mailing list