Re: Unit Testing: temporarily altering django settings

2011-02-21 Thread Phlip
On Feb 21, 12:47 pm, Cody Django wrote: > Thanks -- I didn't know about mock objects, and this is good to know. > But this doesn't feel like this is the solution I'm looking for.  It's > a large project, and your proposal would require extensive patching. Does your project

Re: Unit Testing: temporarily altering django settings

2011-02-21 Thread Mikhail Korobov
Why doesn't setattr work? Just make sure you're setting the proper option because apps often cache options at e.g. their 'config.py' file in order to provide default values: # captha_app/config.py from django.conf import settings CAPTCHA = getattr(settings, 'CAPTCHA', True) So you'll have to

Re: Unit Testing: temporarily altering django settings

2011-02-21 Thread Cody Django
Thanks -- I didn't know about mock objects, and this is good to know. But this doesn't feel like this is the solution I'm looking for. It's a large project, and your proposal would require extensive patching. Is the solution to create a new testrunner that sets a different environment (with

Re: Unit Testing: temporarily altering django settings

2011-02-17 Thread Phlip
On Feb 17, 12:03 pm, Cody Django wrote: > For example, I have a captcha that is used in parts of a site that > affects form logic. > The django settings has a variable CAPTCHA = True, which acts as a > switch. > > I'd like to change this setting in the setup for each

Unit Testing: temporarily altering django settings

2011-02-17 Thread Cody Django
For example, I have a captcha that is used in parts of a site that affects form logic. The django settings has a variable CAPTCHA = True, which acts as a switch. I'd like to change this setting in the setup for each TestCase. The regular unittests tests (in which we are assuming the captcha is