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

C. Titus Brown ctb at msu.edu
Wed Nov 12 12:45:52 PST 2008


On Wed, Nov 12, 2008 at 12:41:14PM -0800, Daryl Spitzer wrote:
-> I apologize if this is a FAQ.  I didn't find the answer (or question)
-> in a quick search.
-> 
-> Is there a convention for where to put unit tests?
-> 
-> I favor putting them in a subdirectory named "UnitTests" (following
-> Michael Foord's example in the Mock sources).  That way I can easily
-> separate the unit tests from integration tests or system tests.
-> 
-> But a colleague states that the python stdlib's tests are in a
-> subdirectory called "tests".  Should I consider that a convention and
-> stick with it (in spite of its disadvantages)?

That's how I do it; I believe both nose and py.test will discover tests
under 'tests/', and I've seen it in other packages, too.

cheers,
--titus
-- 
C. Titus Brown, ctb at msu.edu



More information about the testing-in-python mailing list