[TIP] Where to put unit tests? (What to name subdirectory?)
jml at mumak.net
Wed Nov 12 17:03:43 PST 2008
On Thu, Nov 13, 2008 at 11:45 AM, Barry Warsaw <barry at python.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On Nov 12, 2008, at 3:45 PM, C. Titus Brown wrote:
>> 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
>> -> 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
>> -> 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
>> -> stick with it (in spite of its disadvantages)?
>> That's how I do it; I believe both nose and py.test will discover
>> under 'tests/', and I've seen it in other packages, too.
> I really like putting doctests under a docs/ subdirectory because,
> well that's their primary purpose in life, right? :)
Well, it's certainly not for unit tests:
More information about the testing-in-python