Skip to content

Commit e70c2bc

Browse files
committed
Cleanup coordinator test fixtures
1 parent 4d8f1c4 commit e70c2bc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_coordinator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@
2626

2727
@pytest.fixture
2828
def client(conn):
29-
return KafkaClient(api_version=(0, 9))
29+
cli = KafkaClient(api_version=(0, 9))
30+
yield cli
31+
cli.close()
3032

3133
@pytest.fixture
3234
def coordinator(client):
33-
return ConsumerCoordinator(client, SubscriptionState(), Metrics())
35+
c = ConsumerCoordinator(client, SubscriptionState(), Metrics())
36+
yield c
37+
c.close()
3438

3539

3640
def test_init(client, coordinator):
@@ -400,6 +404,8 @@ def patched_coord(mocker, coordinator):
400404
return_value=1)
401405
mocker.patch.object(coordinator._client, 'ready', return_value=True)
402406
mocker.patch.object(coordinator._client, 'send')
407+
mocker.patch.object(coordinator, '_start_heartbeat_thread')
408+
mocker.patch.object(coordinator, '_close_heartbeat_thread')
403409
mocker.spy(coordinator, '_failed_request')
404410
mocker.spy(coordinator, '_handle_offset_commit_response')
405411
mocker.spy(coordinator, '_handle_offset_fetch_response')

0 commit comments

Comments
 (0)