diff options
-rw-r--r-- | kafka/conn.py | 2 | ||||
-rw-r--r-- | test/test_unit.py | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index 7266ae8..7538e8d 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -19,7 +19,7 @@ def collect_hosts(hosts, randomize=True): randomize the returned list. """ - if isinstance(hosts, str): + if isinstance(hosts, basestring): hosts = hosts.strip().split(',') result = [] diff --git a/test/test_unit.py b/test/test_unit.py index aec0a2c..081acc7 100644 --- a/test/test_unit.py +++ b/test/test_unit.py @@ -449,6 +449,16 @@ class TestKafkaClient(unittest.TestCase): [('kafka01', 9092), ('kafka02', 9092), ('kafka03', 9092)], client.hosts) + def test_init_with_unicode_csv(self): + + with patch.object(KafkaClient, 'load_metadata_for_topics'): + client = KafkaClient( + hosts=u'kafka01:9092,kafka02:9092,kafka03:9092') + + self.assertItemsEqual( + [('kafka01', 9092), ('kafka02', 9092), ('kafka03', 9092)], + client.hosts) + def test_send_broker_unaware_request_fail(self): 'Tests that call fails when all hosts are unavailable' |