Skip to content

Commit

Permalink
Adjust imports in kafka-python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ods committed Oct 21, 2023
1 parent 49302dd commit 57d5471
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ isort[colors]==5.10.0
pytest==7.1.2
pytest-cov==3.0.0
pytest-asyncio==0.18.3
pytest-mock==3.12.0
docker==6.1.2
chardet==4.0.0 # Until fixed requests is released
lz4==3.1.3
Expand Down
4 changes: 2 additions & 2 deletions tests/kafka/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pytest

from test.testutil import env_kafka_version, random_string
from test.fixtures import KafkaFixture, ZookeeperFixture
from tests.kafka.testutil import env_kafka_version, random_string
from tests.kafka.fixtures import KafkaFixture, ZookeeperFixture

@pytest.fixture(scope="module")
def zookeeper():
Expand Down
4 changes: 2 additions & 2 deletions tests/kafka/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from kafka.errors import InvalidReplicationFactorError
from kafka.protocol.admin import CreateTopicsRequest
from kafka.protocol.metadata import MetadataRequest
from test.testutil import env_kafka_version, random_string
from test.service import ExternalService, SpawnedService
from tests.kafka.testutil import env_kafka_version, random_string
from tests.kafka.service import ExternalService, SpawnedService

log = logging.getLogger(__name__)

Expand Down
Empty file added tests/kafka/record/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/kafka/record/test_default_records.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from mock import patch
from unittest.mock import patch
import kafka.codec
from kafka.record.default_records import (
DefaultRecordBatch, DefaultRecordBatchBuilder
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/record/test_legacy_records.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import unicode_literals
import pytest
from mock import patch
from unittest.mock import patch
from kafka.record.legacy_records import (
LegacyRecordBatch, LegacyRecordBatchBuilder
)
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/test_admin_integration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from logging import info
from test.testutil import env_kafka_version, random_string
from tests.kafka.testutil import env_kafka_version, random_string
from threading import Event, Thread
from time import time, sleep

Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/test_codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
zstd_encode, zstd_decode,
)

from test.testutil import random_string
from tests.kafka.testutil import random_string


def test_gzip():
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/test_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from errno import EALREADY, EINPROGRESS, EISCONN, ECONNRESET
import socket

import mock
from unittest import mock
import pytest

from kafka.conn import BrokerConnection, ConnectionStates, collect_hosts
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/test_consumer_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from kafka.coordinator.base import MemberState
from kafka.structs import TopicPartition

from test.testutil import env_kafka_version, random_string
from tests.kafka.testutil import env_kafka_version, random_string


def get_connect_str(kafka_broker):
Expand Down
4 changes: 2 additions & 2 deletions tests/kafka/test_consumer_integration.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import logging
import time

from mock import patch
from unittest.mock import patch
import pytest
from kafka.vendor.six.moves import range

import kafka.codec
from kafka.errors import UnsupportedCodecError, UnsupportedVersionError
from kafka.structs import TopicPartition, OffsetAndTimestamp

from test.testutil import Timer, assert_message_count, env_kafka_version, random_string
from tests.kafka.testutil import Timer, assert_message_count, env_kafka_version, random_string


@pytest.mark.skipif(not env_kafka_version(), reason="No KAFKA_VERSION set")
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/test_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from kafka import KafkaConsumer, KafkaProducer, TopicPartition
from kafka.producer.buffer import SimpleBufferPool
from test.testutil import env_kafka_version, random_string
from tests.kafka.testutil import env_kafka_version, random_string


def test_buffer_pool():
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka/test_sasl_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from kafka.admin import NewTopic
from kafka.protocol.metadata import MetadataRequest_v1
from test.testutil import assert_message_count, env_kafka_version, random_string, special_to_underscore
from tests.kafka.testutil import assert_message_count, env_kafka_version, random_string, special_to_underscore


@pytest.fixture(
Expand Down

0 comments on commit 57d5471

Please sign in to comment.