summaryrefslogtreecommitdiff
path: root/test/test_client_integration.py
diff options
context:
space:
mode:
authorJeff Widman <jeff@jeffwidman.com>2019-08-22 01:58:28 -0700
committerGitHub <noreply@github.com>2019-08-22 01:58:28 -0700
commit98c005852e36fde0ef44a7b9c60a54f4686651af (patch)
tree82f0f218064cd8163addc43042a71207e86cadc9 /test/test_client_integration.py
parente49caeb3ebdd36eb4d18a517bc402f8e89dfdbee (diff)
downloadkafka-python-98c005852e36fde0ef44a7b9c60a54f4686651af.tar.gz
Cleanup handling of KAFKA_VERSION env var in tests (#1887)
Now that we are using `pytest`, there is no need for a custom decorator because we can use `pytest.mark.skipif()`. This makes the code significantly simpler. In particular, dropping the custom `@kafka_versions()` decorator is necessary because it uses `func.wraps()` which doesn't play nice with `pytest` fixtures: - https://github.com/pytest-dev/pytest/issues/677 - https://stackoverflow.com/a/19614807/770425 So this is a pre-requisite to migrating some of those tests to using pytest fixtures.
Diffstat (limited to 'test/test_client_integration.py')
-rw-r--r--test/test_client_integration.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/test_client_integration.py b/test/test_client_integration.py
index df0faef..a983ce1 100644
--- a/test/test_client_integration.py
+++ b/test/test_client_integration.py
@@ -1,5 +1,7 @@
import os
+import pytest
+
from kafka.errors import KafkaTimeoutError
from kafka.protocol import create_message
from kafka.structs import (
@@ -7,7 +9,7 @@ from kafka.structs import (
ProduceRequestPayload)
from test.fixtures import ZookeeperFixture, KafkaFixture
-from test.testutil import KafkaIntegrationTestCase, kafka_versions
+from test.testutil import KafkaIntegrationTestCase, env_kafka_version
class TestKafkaClientIntegration(KafkaIntegrationTestCase):
@@ -80,7 +82,7 @@ class TestKafkaClientIntegration(KafkaIntegrationTestCase):
# Offset Tests #
####################
- @kafka_versions('>=0.8.1')
+ @pytest.mark.skipif(not env_kafka_version(), reason="No KAFKA_VERSION set")
def test_commit_fetch_offsets(self):
req = OffsetCommitRequestPayload(self.topic, 0, 42, 'metadata')
(resp,) = self.client.send_offset_commit_request('group', [req])