summaryrefslogtreecommitdiff
path: root/tests/pipeline.py
diff options
context:
space:
mode:
authorhofmockel <dreagonfly@gmx.de>2013-04-17 15:30:00 +0200
committerhofmockel <dreagonfly@gmx.de>2013-04-17 15:30:00 +0200
commit01237e9efacf0f46fdf1adce502db152085fd7c1 (patch)
treee8ff6e3b4b6cbca141427ec81ebbd7376fded515 /tests/pipeline.py
parent6d38b56db85b821cc5ef86527fcb1497deb80ad9 (diff)
downloadredis-py-01237e9efacf0f46fdf1adce502db152085fd7c1.tar.gz
Read all command responses of a pipeline
Otherwise a error makes the responses stuck in the socket. Which leads to wrong responses for the following commands
Diffstat (limited to 'tests/pipeline.py')
-rw-r--r--tests/pipeline.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pipeline.py b/tests/pipeline.py
index 138fecc..2f8967c 100644
--- a/tests/pipeline.py
+++ b/tests/pipeline.py
@@ -184,3 +184,18 @@ class PipelineTestCase(unittest.TestCase):
result = self.client.transaction(my_transaction, 'a', 'b')
self.assertEquals(result, [True])
self.assertEquals(self.client.get('c'), b('4'))
+
+ def test_error_in_simple_pipeline(self):
+ self.client.hmset('x', {'a': 'b'})
+ with self.client.pipeline(transaction=False) as pipe:
+ pipe.llen('x')
+ pipe.expire('x', 100)
+ try:
+ pipe.execute()
+ except redis.ResponseError:
+ pass
+ else:
+ raise
+
+ ret = self.client.hgetall('x')
+ self.assertEquals(ret, {'a': 'b'})