Skip to content

Commit d036034

Browse files
committed
Fix subprocess log warning; specify timeout_ms kwarg in consumer.poll tests
1 parent feb3cae commit d036034

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _spawn(self):
5959
self.args,
6060
preexec_fn=os.setsid, # to avoid propagating signals
6161
env=self.env,
62-
bufsize=1,
62+
bufsize=0,
6363
stdout=subprocess.PIPE,
6464
stderr=subprocess.PIPE)
6565
self.alive = self.child.poll() is None

test/test_consumer_group.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_consumer(kafka_broker, topic):
2323
# The `topic` fixture is included because
2424
# 0.8.2 brokers need a topic to function well
2525
consumer = KafkaConsumer(bootstrap_servers=get_connect_str(kafka_broker))
26-
consumer.poll(500)
26+
consumer.poll(timeout_ms=500)
2727
assert len(consumer._client._conns) > 0
2828
node_id = list(consumer._client._conns.keys())[0]
2929
assert consumer._client._conns[node_id].state is ConnectionStates.CONNECTED
@@ -34,7 +34,7 @@ def test_consumer(kafka_broker, topic):
3434
def test_consumer_topics(kafka_broker, topic):
3535
consumer = KafkaConsumer(bootstrap_servers=get_connect_str(kafka_broker))
3636
# Necessary to drive the IO
37-
consumer.poll(500)
37+
consumer.poll(timeout_ms=500)
3838
assert topic in consumer.topics()
3939
assert len(consumer.partitions_for_topic(topic)) > 0
4040
consumer.close()
@@ -58,7 +58,7 @@ def consumer_thread(i):
5858
group_id=group_id,
5959
heartbeat_interval_ms=500)
6060
while not stop[i].is_set():
61-
for tp, records in six.itervalues(consumers[i].poll(100)):
61+
for tp, records in six.itervalues(consumers[i].poll(timeout_ms=200)):
6262
messages[i][tp].extend(records)
6363
consumers[i].close()
6464
consumers[i] = None

0 commit comments

Comments
 (0)