Malcolm,

Thanks a lot for the pointer.  For anyone else interested, here is
what my settings-test.py looks like:

from settings import *

# CSRF Middleware breaks auth tests
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES.remove
('django.contrib.csrf.middleware.CsrfMiddleware')

# Turn this off to allow tests that look at http status to pass
PREPEND_WWW = False



I then run the test suite using this command:
python manage.py test --settings=mysite.settings-test.py


Best,
Dave

On Jan 22, 4:50 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Thu, 2009-01-22 at 15:17 -0800,davenaffwrote:
> > What is the best way to disable a specific middleware when running
> > django tests?
>
> > This ticket was designated wontfix, so I get test failures on the auth
> > tests every time I run our test suite:
> >http://code.djangoproject.com/ticket/9172#comment:12
>
> > I'd prefer not to have to edit settings.py every time I run our tests,
> > and of course I don't like tests that fail...
>
> Create a settings file for your testing purposes. It imports your
> standard settings file and then modifies any settings that are specific
> for the tests (e.g. altering the MIDDLEWARE_CLASSES tuple).
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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