On 5/9/07, Glin <[EMAIL PROTECTED]> wrote:
>
> I have exactly same problem. Any solution yet?
>
> BTW. I would like to django run test not only for models, but for
> templatetags (mainly filters), too. And maybe even other files in apps
> (like shortcuts.py etc.). Is that possible?

The simple option is to exploit the doctest finding features that are
part of the Python doctest libraries. See the following for details;

http://docs.python.org/lib/doctest-which-docstrings.html

In short, define a __test__ attribute that is a dictionary pointing to
the modules that contain the doctests you want to run.

This is even easier for unit tests - just import the modules that
contain unit tests into tests.py:

from other.module.mytests import *

and the test runner will discover the tests from your external module.

A slightly more complex way to solve this problem is to write your own
test runner; that is, a modified version of the django.test.simple
module that looks for tests where _you_ want to put them, rather than
the simple 'models.py or tests.py' strategy that is the default.
However, in most cases the simple technique I described above should
be sufficient.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to