Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kstreams/test_utils/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from kstreams.clients import Consumer, Producer
from kstreams.serializers import NO_DEFAULT, Serializer
from kstreams.types import ConsumerRecord, EncodedHeaders
from tests import TimeoutErrorException
from kstreams.utils import TimeoutErrorException

from .structs import RecordMetadata
from .topics import TopicManager
Expand Down
10 changes: 9 additions & 1 deletion kstreams/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ssl
import sys
from tempfile import NamedTemporaryFile
from typing import Any, Optional, Union
from typing import Any, Optional, Type, Union

from aiokafka.helpers import create_ssl_context as aiokafka_create_ssl_context

Expand All @@ -16,6 +16,14 @@
PY_VERSION = sys.version_info


if PY_VERSION < (3, 11):
TimeoutErrorException: Type[Union[asyncio.TimeoutError, TimeoutError]] = (
asyncio.TimeoutError
)
else:
TimeoutErrorException = TimeoutError


def encode_headers(headers: types.Headers) -> types.EncodedHeaders:
return [(header, value.encode()) for header, value in headers.items()]

Expand Down
7 changes: 0 additions & 7 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
import asyncio
import sys

if sys.version_info < (3, 11):
TimeoutErrorException = asyncio.TimeoutError
else:
TimeoutErrorException = TimeoutError
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
TestStreamClient,
TopicManager,
)
from tests import TimeoutErrorException
from kstreams.utils import TimeoutErrorException

topic = "local--kstreams-consumer"
tp0 = TopicPartition(topic=topic, partition=0)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from kstreams.streams import stream
from kstreams.structs import TopicPartitionOffset
from kstreams.test_utils import TestStreamClient
from tests import TimeoutErrorException
from kstreams.utils import TimeoutErrorException

# NOTE: remove the test when `no typing` support is deprecated

Expand Down
Loading