Skip to content

Commit 4ad6b8c

Browse files
committed
Only run store offset closed RuntimeError test for newer version of rdkafka
1 parent 0119aff commit 4ad6b8c

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tests/test_Consumer.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ def test_any_method_after_close_throws_exception():
216216
c.assignment()
217217
assert 'Consumer closed' == str(ex.value)
218218

219-
with pytest.raises(RuntimeError) as ex:
220-
c.store_offsets(offsets=[TopicPartition("test", 0, 42)])
221-
assert 'Consumer closed' == str(ex.value)
222-
223219
with pytest.raises(RuntimeError) as ex:
224220
c.commit()
225221
assert 'Consumer closed' == str(ex.value)
@@ -235,3 +231,23 @@ def test_any_method_after_close_throws_exception():
235231
with pytest.raises(RuntimeError) as ex:
236232
lo, hi = c.get_watermark_offsets(TopicPartition("test", 0))
237233
assert 'Consumer closed' == str(ex.value)
234+
235+
236+
@pytest.mark.skipif(libversion()[1] < 0x000b0000,
237+
reason="requires librdkafka >=0.11.0")
238+
def test_calling_store_offsets_after_close_throws_erro():
239+
""" calling store_offset after close should throw RuntimeError """
240+
241+
c = Consumer({'group.id': 'test',
242+
'enable.auto.commit': True,
243+
'enable.auto.offset.store': False,
244+
'socket.timeout.ms': 50,
245+
'session.timeout.ms': 100})
246+
247+
c.subscribe(["test"])
248+
c.unsubscribe()
249+
c.close()
250+
251+
with pytest.raises(RuntimeError) as ex:
252+
c.store_offsets(offsets=[TopicPartition("test", 0, 42)])
253+
assert 'Consumer closed' == str(ex.value)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy