mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #29887 -- Simplified memcached client instantiation.
This commit is contained in:
committed by
Mariusz Felisiak
parent
7a60670b78
commit
cc1f2c6a19
6
tests/cache/tests.py
vendored
6
tests/cache/tests.py
vendored
@@ -1374,7 +1374,7 @@ class BaseMemcachedTests(BaseCacheTests):
|
||||
# connection is closed when the request is complete.
|
||||
signals.request_finished.disconnect(close_old_connections)
|
||||
try:
|
||||
with mock.patch.object(cache._lib.Client, 'disconnect_all', autospec=True) as mock_disconnect:
|
||||
with mock.patch.object(cache._class, 'disconnect_all', autospec=True) as mock_disconnect:
|
||||
signals.request_finished.send(self.__class__)
|
||||
self.assertIs(mock_disconnect.called, self.should_disconnect_on_close)
|
||||
finally:
|
||||
@@ -1383,7 +1383,7 @@ class BaseMemcachedTests(BaseCacheTests):
|
||||
def test_set_many_returns_failing_keys(self):
|
||||
def fail_set_multi(mapping, *args, **kwargs):
|
||||
return mapping.keys()
|
||||
with mock.patch('%s.Client.set_multi' % self.client_library_name, side_effect=fail_set_multi):
|
||||
with mock.patch.object(cache._class, 'set_multi', side_effect=fail_set_multi):
|
||||
failing_keys = cache.set_many({'key': 'value'})
|
||||
self.assertEqual(failing_keys, ['key'])
|
||||
|
||||
@@ -1395,7 +1395,6 @@ class BaseMemcachedTests(BaseCacheTests):
|
||||
))
|
||||
class MemcachedCacheTests(BaseMemcachedTests, TestCase):
|
||||
base_params = MemcachedCache_params
|
||||
client_library_name = 'memcache'
|
||||
|
||||
def test_memcached_uses_highest_pickle_version(self):
|
||||
# Regression test for #19810
|
||||
@@ -1427,7 +1426,6 @@ class MemcachedCacheTests(BaseMemcachedTests, TestCase):
|
||||
))
|
||||
class PyLibMCCacheTests(BaseMemcachedTests, TestCase):
|
||||
base_params = PyLibMCCache_params
|
||||
client_library_name = 'pylibmc'
|
||||
# libmemcached manages its own connections.
|
||||
should_disconnect_on_close = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user