Skip to content

Commit

Permalink
update Memcached tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drcpu-github committed Jul 22, 2023
1 parent 9d41d82 commit 96103b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/test_interface_uniformity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
@pytest.fixture(autouse=True)
def create_cache_list(request, tmpdir):
mc = MemcachedCache()
mc._client.flush_all()
if mc.pylibmc_used:
with mc._client.reserve(block=mc.blocking) as client:
client.flush_all()
else:
mc._client.flush_all()
rc = RedisCache(port=6360)
rc._write_client.flushdb()
request.cls.cache_list = [FileSystemCache(tmpdir), mc, rc, SimpleCache()]
Expand Down
6 changes: 5 additions & 1 deletion tests/test_memcached_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
def cache_factory(request):
def _factory(self, *args, **kwargs):
mc = MemcachedCache(*args, **kwargs)
mc._client.flush_all()
if mc.pylibmc_used:
with mc._client.reserve(block=mc.blocking) as client:
client.flush_all()
else:
mc._client.flush_all()
return mc

request.cls.cache_factory = _factory
Expand Down

0 comments on commit 96103b1

Please sign in to comment.