Skip to content

test: add tests for connection error handling - #8

Open
Shreyas-Gowda26 wants to merge 2 commits into
StreamLineLabs:mainfrom
Shreyas-Gowda26:main
Open

test: add tests for connection error handling#8
Shreyas-Gowda26 wants to merge 2 commits into
StreamLineLabs:mainfrom
Shreyas-Gowda26:main

Conversation

@Shreyas-Gowda26

@Shreyas-Gowda26 Shreyas-Gowda26 commented Feb 28, 2026

Copy link
Copy Markdown

Closes #6
Added tests/test_connection_errors.py with pytest tests for connection failures:

  • Server unreachable
  • Connection timeout
  • DNS resolution failure
  • Client cleanup after failed connection
  • Reconnection after failure
  • Context manager handling connection errors

Uses unittest.mock to simulate network failures without needing a real server.

Closes #5

Added missing type annotations across the SDK to pass mypy --strict:

  • exceptions.py: added return types and replaced str | None with Optional[str]
  • types.py: added Iterator return type to iter and len
  • client.py: typed **kwargs and aexit parameters
  • producer.py: typed aexit parameters
  • consumer.py: typed aexit and added explicit casts for aiokafka returns
  • admin.py: typed aexit parameters
  • serializers.py: added explicit casts and typed dict parameters
  • retry.py: added Callable[..., Any] type parameters
  • telemetry.py: added Callable[..., Any] type parameters

All 32 mypy --strict errors resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add tests for connection error handling docs: Add type annotations to all public API methods

1 participant