Re: Disabling middleware for tests

2009-02-16 Thread stryderjzw
Ah yeah, of course I can put a print statement. Thanks Malcolm. Your many posts have helped me greatly in the past. Looks like it works with a new Django project. I am using Pinax and they alter the manage.py file slightly. Can't see why it's not working though. I guess I'll have to dig in

Re: Disabling middleware for tests

2009-02-16 Thread Malcolm Tredinnick
On Mon, 2009-02-16 at 18:36 -0800, stryderjzw wrote: [...] > However, I'm running into the problem that I have no clue if manage.py > ever read my settings file correctly. The settings file is executable (well, importable) Python code, so put a print statement in there that will display

Re: Disabling middleware for tests

2009-02-16 Thread stryderjzw
Well, looking at Ticket 9172 (http://code.djangoproject.com/ticket/ 9172), we're supposed to be turning off the CSRF middleware during tests. I believe we can do that by writing another settings file, disabling the Csrf Middleware and using that settings file to run our tests, as per this

Re: Disabling middleware for tests

2009-02-16 Thread felix
ah ha. yes, I've wasted several hours over this issue. it took me a while to figure out that it was the CSRF middleware that was breaking the tests. both auth tests and actually every single one that tests the posting of forms. I didn't see it mention of this issue in either the CSRF docs or

Re: Disabling middleware for tests

2009-02-16 Thread stryderjzw
This doesn't seem to be working for me. I created my own test_settings.py in the project root directory. I ran python manage.py test --settings=test_settings It runs as usual and CSRF still fails when I run tests. Anyone know what I might be doing wrong here? How can I tell that python

Re: Disabling middleware for tests

2009-01-26 Thread davenaff
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')

Re: Disabling middleware for tests

2009-01-22 Thread Malcolm Tredinnick
On Thu, 2009-01-22 at 15:17 -0800, davenaff wrote: > 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: >

Disabling middleware for tests

2009-01-22 Thread davenaff
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