| @pytest.mark.unit
|
| def test_redis_context_manager():
|
|
|
|
|
| from rtrader.utils.redis import RedisKeyValue, RedisLocal
|
| with RedisKeyValue(RedisLocal(), 'keys', []) as redis:
|
| redis.value.append('key1')
|
| redis.value.append('key2')
|
| print(redis.value)
|
|
|
| redisl = RedisLocal()
|
| keys = redisl.load('keys')
|
| > assert 'key1' in keys
|
| E AssertionError: assert 'key1' in []
|
|
|
| RedisKeyValue = <class 'rtrader.utils.redis.RedisKeyValue'>
|
| RedisLocal = <singleton_decorator.decorator._SingletonWrapper object at 0x115a6cd90>
|
| keys = []
|
| redis = <rtrader.utils.redis.RedisKeyValue object at 0x13fd46a90>
|
| redisl = <rtrader.utils.redis.RedisLocal object at 0x115a6cfa0>
|
|
|
| tests/test_redis.py:39: AssertionError
|