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

Aaron Maxwell amax at redsymbol.net
Wed Nov 12 12:55:16 PST 2008


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