On 25/07/2011 13:27, Alfredo Deza wrote:
> 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
> acceptable difference.
>> 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 [0]
>
Now that django 1.3 includes unittest2 it *should* be possible to have
test discovery. I haven't looked into it though.
> 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.
>
We still name our tests "test_foo.py". I would consider it odd to not do
this.
> py.test, nose and I *think* that unittest2 have the same convention
> for autodiscovery.
>Yep (for unittest2).
Michael
> 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!
>>> -Alfredo
>>>> [0] https://docs.djangoproject.com/search/?q=test+discovery&release=5> <https://docs.djangoproject.com/search/?q=test+discovery&release=5>
>>> _______________________________________________
> testing-in-python mailing list
>testing-in-python at lists.idyll.org>http://lists.idyll.org/listinfo/testing-in-python
--
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20110725/21c430cb/attachment.htm>