Skip to content

Commit

Permalink
Update base client dependency to v0.6
Browse files Browse the repository at this point in the history
Also removes passing the channel type to the base client.

Signed-off-by: cwasicki <[email protected]>
  • Loading branch information
cwasicki committed Sep 19, 2024
1 parent 63cd246 commit d19b4e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies = [
"grpcio >= 1.54.2, < 2",
"grpcio-tools >= 1.54.2, < 2",
"protobuf >= 4.25.3, < 6",
"frequenz-client-base[grpcio] >= 0.5.0, < 0.6.0",
"frequenz-client-base >= 0.6.0, < 0.7.0",
]
dynamic = ["version"]

Expand Down
4 changes: 2 additions & 2 deletions src/frequenz/client/reporting/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def __iter__(self) -> Iterator[MetricSample]:
)


class ReportingApiClient(BaseApiClient[ReportingStub, grpcaio.Channel]):
class ReportingApiClient(BaseApiClient[ReportingStub]):
"""A client for the Reporting service."""

def __init__(self, server_url: str, key: str | None = None) -> None:
Expand All @@ -147,7 +147,7 @@ def __init__(self, server_url: str, key: str | None = None) -> None:
server_url: The URL of the Reporting service.
key: The API key for the authorization.
"""
super().__init__(server_url, ReportingStub, grpcaio.Channel)
super().__init__(server_url, ReportingStub)

self._metadata = (("key", key),) if key else ()

Expand Down
7 changes: 2 additions & 5 deletions tests/test_client_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""Tests for the frequenz.client.reporting package."""
from unittest.mock import MagicMock, patch

import grpc.aio as grpcaio
import pytest
from frequenz.api.reporting.v1.reporting_pb2_grpc import ReportingStub
from frequenz.client.base.client import BaseApiClient
Expand All @@ -15,12 +14,10 @@

@pytest.mark.asyncio
async def test_client_initialization() -> None:
"""Test that the client initializes the BaseApiClient with grpcaio.Channel."""
"""Test that the client initializes the BaseApiClient."""
with patch.object(BaseApiClient, "__init__", return_value=None) as mock_base_init:
client = ReportingApiClient("gprc://localhost:50051") # noqa: F841
mock_base_init.assert_called_once_with(
"gprc://localhost:50051", ReportingStub, grpcaio.Channel
)
mock_base_init.assert_called_once_with("gprc://localhost:50051", ReportingStub)


def test_components_data_batch_is_empty_true() -> None:
Expand Down

0 comments on commit d19b4e9

Please sign in to comment.