summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2019-06-01 16:19:47 -0700
committerAndy McCurdy <andy@andymccurdy.com>2019-06-01 16:19:47 -0700
commit2b9b9088ec1b58c95c61aa95da505f66e2a50a34 (patch)
tree6ddd0adf6d77c448d7143ee74fbbe6466a8b3b5f
parente3e97699a0d37bdf1c8a37e468480d2b9d98a861 (diff)
downloadredis-py-2b9b9088ec1b58c95c61aa95da505f66e2a50a34.tar.gz
test to ensure a ConnectionError is raised when a pubsub connection dies
-rw-r--r--tests/test_pubsub.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_pubsub.py b/tests/test_pubsub.py
index fc91abf..7f94b4a 100644
--- a/tests/test_pubsub.py
+++ b/tests/test_pubsub.py
@@ -490,3 +490,16 @@ class TestPubSubPings(object):
assert wait_for_message(p) == make_message(type='pong', channel=None,
data='hello world',
pattern=None)
+
+
+class TestPubSubConnectionKilled(object):
+
+ @skip_if_server_version_lt('3.0.0')
+ def test_connection_error_raised_when_connection_dies(self, r):
+ p = r.pubsub(ignore_subscribe_messages=True)
+ p.subscribe('foo')
+ for client in r.client_list():
+ if client['cmd'] == 'subscribe':
+ r.client_kill_filter(_id=client['id'])
+ with pytest.raises(ConnectionError):
+ wait_for_message(p)