Redis – Pytest: How to test a function that contains a global variable?
I am using redis in the following way: from redis import Redis redis_client = Redis() def get_datetime_from_redis(key): start_time = redis_client.get(key) start_time = datetime.strptime(datetime_as_string, "%Y-%m-%d %H:%M:%S.%f") duration = (datetime.now() - start_time).total_seconds() return duration I'd like to test the function in the…