From 724f1b8575f8d7895b7ad8cecafbebc13805ec9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Kuti?= Date: Wed, 8 Nov 2023 13:46:12 +0100 Subject: [PATCH] Linting fixes --- karapace/kafka_admin.py | 2 +- tests/integration/test_kafka_admin.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/karapace/kafka_admin.py b/karapace/kafka_admin.py index 4cea87450..daef518ca 100644 --- a/karapace/kafka_admin.py +++ b/karapace/kafka_admin.py @@ -271,6 +271,6 @@ def get_offsets(self, topic: str, partition_id: int) -> dict[str, int]: except KafkaException as exc: code = exc.args[0].code() if code < 0: - raise UnknownTopicOrPartitionError() + raise UnknownTopicOrPartitionError() from exc raise_from_kafkaexception(exc) return {"beginning_offset": startoffset.offset, "end_offset": endoffset.offset} diff --git a/tests/integration/test_kafka_admin.py b/tests/integration/test_kafka_admin.py index 3657436c1..59cb90aa9 100644 --- a/tests/integration/test_kafka_admin.py +++ b/tests/integration/test_kafka_admin.py @@ -8,7 +8,7 @@ from kafka import KafkaProducer from kafka.errors import UnknownTopicOrPartitionError from karapace.kafka_admin import ConfigSource, KafkaAdminClient, NewTopic -from tests.utils import new_topic +from tests.utils import new_topic as create_new_topic import pytest @@ -21,7 +21,7 @@ def test_cluster_metadata_brokers(self, admin_client: KafkaAdminClient) -> None: assert len(cluster_metadata["brokers"]) == 1, "Only one broker during tests" def test_cluster_metadata_all_topics(self, admin_client: KafkaAdminClient) -> None: - topic_names = [new_topic(admin_client) for _ in range(5)] + topic_names = [create_new_topic(admin_client) for _ in range(5)] topics_metadata = admin_client.cluster_metadata()["topics"] @@ -131,7 +131,7 @@ def test_get_offsets_raises_for_unknown_partition(self, admin_client: KafkaAdmin class TestDeleteTopic: def test_delete_topic(self, admin_client: KafkaAdminClient) -> None: - topic_name = new_topic(admin_client) + topic_name = create_new_topic(admin_client) topics_metadata_before_delete = admin_client.cluster_metadata()["topics"] admin_client.delete_topic(topic_name)