Refactoring
This commit is contained in:
parent
56f1d35de9
commit
0ae8ef882e
1 changed files with 5 additions and 5 deletions
|
@ -42,13 +42,13 @@ def cleanup_keys(request):
|
||||||
from redis_om.connections import get_redis_connection as get_sync_redis
|
from redis_om.connections import get_redis_connection as get_sync_redis
|
||||||
|
|
||||||
# Increment for every pytest-xdist worker
|
# Increment for every pytest-xdist worker
|
||||||
redis = get_sync_redis()
|
conn = get_sync_redis()
|
||||||
once_key = f"{TEST_PREFIX}:cleanup_keys"
|
once_key = f"{TEST_PREFIX}:cleanup_keys"
|
||||||
redis.incr(once_key)
|
conn.incr(once_key)
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
# Delete keys only once
|
# Delete keys only once
|
||||||
if redis.decr(once_key) == 0:
|
if conn.decr(once_key) == 0:
|
||||||
_delete_test_keys(TEST_PREFIX, redis)
|
_delete_test_keys(TEST_PREFIX, conn)
|
||||||
redis.delete(once_key)
|
conn.delete(once_key)
|
||||||
|
|
Loading…
Reference in a new issue