Fix the AttributeError: __exit__ error
The memcache client class actually has no __exit__ function. Remove the "with" usage to avoid the __exit__ error. Change-Id: I15b3d08f4afae289e7eb0848ff1db08141196d3c Closes-Bug: #1747565
This commit is contained in:
parent
ce06c0ce10
commit
33a712bed7
|
@ -98,8 +98,7 @@ class _MemcacheClientPool(object):
|
|||
|
||||
@contextlib.contextmanager
|
||||
def reserve(self):
|
||||
with self._pool.get() as client:
|
||||
yield client
|
||||
yield self._pool.get()
|
||||
|
||||
|
||||
class TokenCache(object):
|
||||
|
|
|
@ -151,11 +151,17 @@ class TestLiveMemcache(base.BaseAuthTokenTestCase):
|
|||
token_cache.set(token, data)
|
||||
self.assertEqual(token_cache.get(token), data)
|
||||
|
||||
def test_memcache_pool_init(self):
|
||||
def test_memcache_pool(self):
|
||||
conf = {
|
||||
'memcached_servers': ','.join(MEMCACHED_SERVERS),
|
||||
'memcache_use_advanced_pool': True
|
||||
}
|
||||
|
||||
token = six.b(uuid.uuid4().hex)
|
||||
data = uuid.uuid4().hex
|
||||
|
||||
token_cache = self.create_simple_middleware(conf=conf)._token_cache
|
||||
token_cache.initialize({})
|
||||
|
||||
token_cache.set(token, data)
|
||||
self.assertEqual(token_cache.get(token), data)
|
||||
|
|
Loading…
Reference in New Issue