Skip to content

Commit e8cb888

Browse files
authored
Fix skipped integration tests if KAFKA_VERSION unset (#1453)
1 parent 18e48dc commit e8cb888

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

test/test_consumer_integration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import time
44

5+
import pytest
56
from six.moves import xrange
67
import six
78

@@ -19,12 +20,14 @@
1920
ProduceRequestPayload, TopicPartition, OffsetAndTimestamp
2021
)
2122

23+
from test.conftest import version
2224
from test.fixtures import ZookeeperFixture, KafkaFixture
2325
from test.testutil import (
2426
KafkaIntegrationTestCase, kafka_versions, random_string, Timer,
2527
send_messages
2628
)
2729

30+
@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
2831
def test_kafka_consumer(simple_client, topic, kafka_consumer_factory):
2932
"""Test KafkaConsumer
3033
"""

test/test_producer_integration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33
import uuid
44

5+
import pytest
56
from six.moves import range
67

78
from kafka import (
@@ -14,9 +15,11 @@
1415
from kafka.producer.base import Producer
1516
from kafka.structs import FetchRequestPayload, ProduceRequestPayload
1617

18+
from test.conftest import version
1719
from test.fixtures import ZookeeperFixture, KafkaFixture
1820
from test.testutil import KafkaIntegrationTestCase, kafka_versions, current_offset
1921

22+
2023
# TODO: This duplicates a TestKafkaProducerIntegration method temporarily
2124
# while the migration to pytest is in progress
2225
def assert_produce_request(client, topic, messages, initial_offset, message_ct,
@@ -32,13 +35,16 @@ def assert_produce_request(client, topic, messages, initial_offset, message_ct,
3235

3336
assert current_offset(client, topic, partition) == initial_offset + message_ct
3437

38+
3539
def assert_produce_response(resp, initial_offset):
3640
"""Verify that a produce response is well-formed
3741
"""
3842
assert len(resp) == 1
3943
assert resp[0].error == 0
4044
assert resp[0].offset == initial_offset
4145

46+
47+
@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
4248
def test_produce_many_simple(simple_client, topic):
4349
"""Test multiple produces using the SimpleClient
4450
"""

0 commit comments

Comments
 (0)