def with_config(**options):
 def decorator(func):
  old = {}
  def setup():
   for (k, v) in options.iteritems():
    old[k] = getattr(settings, k, None)
    setattr(settings, k, v)
  def teardown():
   for (k, v) in old.iteritems():
    setattr(settings, k, v)
  return with_setup(setup, teardown)(func)
 return decorator

def with_config ( ** options ) : def decorator ( func ) : old = { } def setup ( ) : for ( k , v ) in options . iteritems ( ) : old [ k ] = getattr ( settings , k , None ) setattr ( settings , k , v ) def teardown ( ) : for ( k , v ) in old . iteritems ( ) : setattr ( settings , k , v ) return with_setup ( setup , teardown ) ( func ) return decorator
decorator to run a test with the given config options .