summaryrefslogtreecommitdiff
path: root/tests/test_pipeline.py
diff options
context:
space:
mode:
authorBrian Maissy <brian@medigate.io>2019-10-24 09:29:00 +0300
committerAndy McCurdy <andy@andymccurdy.com>2019-10-24 00:06:11 -0700
commitc1415c296be56ec14fa29aaa2af04eb1c8278f77 (patch)
tree9cb9adddb1404c7d8418902da04f715e4b690156 /tests/test_pipeline.py
parentfa0b0392c86126cae1a264197dddab647fa37821 (diff)
downloadredis-py-c1415c296be56ec14fa29aaa2af04eb1c8278f77.tar.gz
Allow Pipeline.execute() to execute on empty command stack if it is watching keys
Diffstat (limited to 'tests/test_pipeline.py')
-rw-r--r--tests/test_pipeline.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index 2e2507a..264a64f 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -191,6 +191,19 @@ class TestPipeline(object):
assert not pipe.watching
+ def test_watch_failure_in_empty_transaction(self, r):
+ r['a'] = 1
+ r['b'] = 2
+
+ with r.pipeline() as pipe:
+ pipe.watch('a', 'b')
+ r['b'] = 3
+ pipe.multi()
+ with pytest.raises(redis.WatchError):
+ pipe.execute()
+
+ assert not pipe.watching
+
def test_unwatch(self, r):
r['a'] = 1
r['b'] = 2