Re: Discover tests in forms.py
> If your looking for an example to follow, the code for > django.test.simple isn't too hard to tear apart and customize for your > own purposes. OK. Here's how I solved it: from django.test.simple import * from django.test.simple import run_tests as orig_run_tests # my app is called 'classes' import classes.forms def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]): d = locals() d.pop('test_labels') extra_tests.append(build_suite(classes.forms)) return orig_run_tests(test_labels, **d) That works great and I now need to make it non-hardcoded. I like how it doesn't repeat the code from simple.py much which is key to me for new upgrades of django itself. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Discover tests in forms.py
On Thu, Sep 4, 2008 at 11:13 PM, Peter Bengtsson <[EMAIL PROTECTED]> wrote: > > From http://www.djangoproject.com/documentation/testing/ > "4. Looking for unit tests and doctests in the models.py and tests.py > files in each installed application." > > Next to models.py I have forms.py which does exactly what the filename > suggests: it defines forms. I've put some doctests in these classes. > How do I get the testrunner to discover them? Hi Peter, The short answer is "it wont". The default test runner only looks in models.py and tests.py. However, if you want to put your tests somewhere else (such as in forms.py), you can define your own test runner which implements its own test discovery strategy. This is documented: http://docs.djangoproject.com/en/dev/topics/testing/#using-different-testing-frameworks If your looking for an example to follow, the code for django.test.simple isn't too hard to tear apart and customize for your own purposes. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Discover tests in forms.py
>From http://www.djangoproject.com/documentation/testing/ "4. Looking for unit tests and doctests in the models.py and tests.py files in each installed application." Next to models.py I have forms.py which does exactly what the filename suggests: it defines forms. I've put some doctests in these classes. How do I get the testrunner to discover them? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---