On Wed, Mar 4, 2009 at 10:10 PM, madhav <madhav....@gmail.com> wrote:
>
> I have built my website in Django. And like any other django project I
> have got apps inside the project root directory and some special
> folders like(extensions a.k.a custom django command extensions). With
> an app, we dont have any problem with having testcases. "tests.py"
> inside the app directory will be the solution. But for a special folder
> (which is not an app or which doesn't have a models.py) where do I
> place the testcases. I tried placing the tests.py inside the
> extensions directory and it said the directory is not a model and
> unable to run the tests. HOw do I solve this? How can I have a proper
> placement of testcases related to non-apps?

The trivial solution would be to piggyback your tests into the tests
module of an actual Django app. This would mean the tests for your
utility folder will get mixed in with the tests for a specific
application, but if you have a 'core/root' type application, the
confusion shouldn't be too extreme.

A slightly better solution is to make your utility folder appear to be
an application. Put an empty models.py file in your utility folder,
and add the utility folder to INSTALLED_APPS. This won't affect the
operation of Django - since there are no models, the utility folder
won't appear anywhere - but Django will be able to find the tests.

A third, slightly more complex solution would be to override the test
runner to modify the test discovery procedure. At present, the test
finder looks in the tests module for each installed app; this could
easily be modified to include other directories.

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 django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to