MCPcopy
hub / github.com/redis/redis-py / r_teardown

Function r_teardown

tests/test_asyncio/test_commands.py:61–79  ·  view source on GitHub ↗

A special fixture which removes the provided names from the database after use

(r: redis.Redis)

Source from the content-addressed store, hash-verified

59
60@pytest_asyncio.fixture()
61async def r_teardown(r: redis.Redis):
62 """
63 A special fixture which removes the provided names from the database after use
64 """
65 usernames = []
66
67 def factory(username):
68 usernames.append(username)
69 return r
70
71 yield factory
72 try:
73 client_info = await r.client_info()
74 except exceptions.NoPermissionError:
75 client_info = {}
76 if "default" != client_info.get("user", ""):
77 await r.auth("", "default")
78 for username in usernames:
79 await r.acl_deluser(username)
80
81
82@pytest_asyncio.fixture()

Calls 4

client_infoMethod · 0.80
authMethod · 0.80
acl_deluserMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected