How to mock a redis client in Python?
问题 I just found that a bunch of unit tests are failing, due a developer hasn't mocked out the dependency to a redis client within the test. I'm trying to give a hand in this matter but have difficulties myself. The method writes to a redis client: redis_client = get_redis_client() redis_client.set('temp-facility-data', cPickle.dumps(df)) Later in the assert the result is retrieved: res = cPickle.loads(get_redis_client().get('temp-facility-data')) expected = pd.Series([set([1, 2, 3, 4, 5])],