Skip to content

Commit 6163a77

Browse files
author
Gabriel Tincu
committed
Update producer test to use pytest.skip instead of return statements
1 parent ca756d3 commit 6163a77

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

test/test_producer.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ def test_buffer_pool():
2626
@pytest.mark.parametrize("compression", [None, 'gzip', 'snappy', 'lz4', 'zstd'])
2727
def test_end_to_end(kafka_broker, compression):
2828
if compression == 'lz4':
29-
# LZ4 requires 0.8.2
3029
if env_kafka_version() < (0, 8, 2):
31-
return
32-
# python-lz4 crashes on older versions of pypy
30+
pytest.skip('LZ4 requires 0.8.2')
3331
elif platform.python_implementation() == 'PyPy':
34-
return
32+
pytest.skip('python-lz4 crashes on older versions of pypy')
3533

3634
if compression == 'zstd' and env_kafka_version() < (2, 1, 0):
3735
return
@@ -87,7 +85,7 @@ def test_kafka_producer_gc_cleanup():
8785
@pytest.mark.parametrize("compression", [None, 'gzip', 'snappy', 'lz4', 'zstd'])
8886
def test_kafka_producer_proper_record_metadata(kafka_broker, compression):
8987
if compression == 'zstd' and env_kafka_version() < (2, 1, 0):
90-
return
88+
pytest.skip('zstd requires 2.1.0 or more')
9189
connect_str = ':'.join([kafka_broker.host, str(kafka_broker.port)])
9290
producer = KafkaProducer(bootstrap_servers=connect_str,
9391
retries=5,
@@ -130,10 +128,8 @@ def test_kafka_producer_proper_record_metadata(kafka_broker, compression):
130128
if headers:
131129
assert record.serialized_header_size == 22
132130

133-
# generated timestamp case is skipped for broker 0.9 and below
134131
if magic == 0:
135-
return
136-
132+
pytest.skip('generated timestamp case is skipped for broker 0.9 and below')
137133
send_time = time.time() * 1000
138134
future = producer.send(
139135
topic,

0 commit comments

Comments
 (0)