def setUp(self): with mock.patch.object(memcache, 'Client', Client): self.storage = MemcachedStorage('localhost:11211') if not self.storage.storage.set('test', 'test'): raise Exception('memcached is down')