From 0ae8ef882e8c04f544c2b069573d9ac1a93d36b2 Mon Sep 17 00:00:00 2001 From: Serhii Charykov Date: Wed, 27 Apr 2022 20:01:17 +0300 Subject: [PATCH] Refactoring --- tests/conftest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f6139d9..d14f0a5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -42,13 +42,13 @@ def cleanup_keys(request): from redis_om.connections import get_redis_connection as get_sync_redis # Increment for every pytest-xdist worker - redis = get_sync_redis() + conn = get_sync_redis() once_key = f"{TEST_PREFIX}:cleanup_keys" - redis.incr(once_key) + conn.incr(once_key) yield # Delete keys only once - if redis.decr(once_key) == 0: - _delete_test_keys(TEST_PREFIX, redis) - redis.delete(once_key) + if conn.decr(once_key) == 0: + _delete_test_keys(TEST_PREFIX, conn) + conn.delete(once_key)