From 11cf3973bfc64ab0b4e471fc56dae911df1ec8d9 Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Thu, 10 May 2018 16:12:19 -0700 Subject: Stop shadowing `ConnectionError` In Python3, `ConnectionError` is a native exception. So rename our custom one to `KafkaConnectionError` to prevent accidentally shadowing the native one. Note that there are still valid uses of `ConnectionError` in this code. They already expect a native Python3 `ConnectionError`, and also already handle the Python2 compatibility issues. --- test/test_failover_integration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test_failover_integration.py') diff --git a/test/test_failover_integration.py b/test/test_failover_integration.py index 797e1c8..ad7dcb9 100644 --- a/test/test_failover_integration.py +++ b/test/test_failover_integration.py @@ -4,7 +4,7 @@ import time from kafka import SimpleClient, SimpleConsumer, KeyedProducer from kafka.errors import ( - FailedPayloadsError, ConnectionError, RequestTimedOutError, + FailedPayloadsError, KafkaConnectionError, RequestTimedOutError, NotLeaderForPartitionError) from kafka.producer.base import Producer from kafka.structs import TopicPartition @@ -79,7 +79,7 @@ class TestFailover(KafkaIntegrationTestCase): producer.send_messages(topic, partition, b'success') log.debug("success!") recovered = True - except (FailedPayloadsError, ConnectionError, RequestTimedOutError, + except (FailedPayloadsError, KafkaConnectionError, RequestTimedOutError, NotLeaderForPartitionError): log.debug("caught exception sending message -- will retry") continue @@ -167,7 +167,7 @@ class TestFailover(KafkaIntegrationTestCase): producer.send_messages(topic, key, msg) if producer.partitioners[topic].partition(key) == 0: recovered = True - except (FailedPayloadsError, ConnectionError, RequestTimedOutError, + except (FailedPayloadsError, KafkaConnectionError, RequestTimedOutError, NotLeaderForPartitionError): log.debug("caught exception sending message -- will retry") continue -- cgit v1.2.1