A special fixture which removes the provided names from the database after use
(r: redis.Redis)
| 59 | |
| 60 | @pytest_asyncio.fixture() |
| 61 | async 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() |
no test coverage detected