Re: Best way to tell if we're in a test

2011-04-29 Thread Jody McIntyre
This is fine as a general principle, but here we're dealing with middleware that affects every other application. It's not a good idea to require other applications to change all their tests to mock out functionality in a module they've just added, plus that would be a lot of work. You'd have to

Re: Best way to tell if we're in a test

2011-04-29 Thread Chris Czub
I think you might be taking the wrong approach. Rather than having your application code checking whether or not it's in a test, have your testing code disable/mock certain behaviors that you don't want exercised(like have it always return that the user answered the security question correctly or

Best way to tell if we're in a test

2011-04-29 Thread Jody McIntyre
What's the best way to tell (from regular code) if we're in a test? I have added extra authentication steps (security questions) that would be difficult to deal with in tests where you just want to run self.client.login() or post to the login URL. I've noticed that several third party