[TIP] Naming Conventions for testing
alfredodeza at gmail.com
Mon Jul 25 05:27:13 PDT 2011
I think I've always been in happy land when it comes to naming and other
conventions for testing.
Like prefacing your test files with "test" and placing them in a "test[s]"
directory. There are slight
differences to that, like adding the test[s] module inside the actual
package or not, which is still a rather
And I am completely OK with those slight differences.
I am currently faced with a Django application that has tests in a
`tests.py` file or a `tests` module that
imports every test class that needs to be tested in `__init__.py`. I tried
looking for test discovery and
auto-discovery in the Django docs but came empty handed 
The reasoning for the above test structure is because Django's test runner
will look for a tests module and
will run tests found there. If it is a directory, then only tests that are
imported in `__init__.py` will be run.
Again, no docs that I could find to support that (maybe this is a *custom*
thing in this app?)
My issue with this, is that it lends to have test files that are named
`feature_foo.py` and not `test_foo.py`.
Which it ends up breaking everything I've been used to until this moment.
py.test, nose and I *think* that unittest2 have the same convention for
I am not complaining though, but my questions are:
* Am I wrong to have assumed we had a testing convention?
* Is it just Django that does something like this? Or where are the docs
that state otherwise?
Feedback/input is greatly appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python