Skip to content
Snippets Groups Projects
Commit d68adb73 authored by Carlos Natalino Da Silva's avatar Carlos Natalino Da Silva
Browse files

Fixing tests of the dbscanserving.

parent 5949b54d
No related branches found
No related tags found
No related merge requests found
...@@ -66,8 +66,7 @@ class DbscanServingClient: ...@@ -66,8 +66,7 @@ class DbscanServingClient:
response: DetectionResponse = self.stub.Detect(request) response: DetectionResponse = self.stub.Detect(request)
LOGGER.debug( LOGGER.debug(
"Detect result with {} cluster indices [{}]".format( "Detect result with {} cluster indices [{}]".format(
len(response.cluster_indices), len(response.cluster_indices), Counter(response.cluster_indices)
Counter(response.cluster_indices)
) )
) )
return response return response
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# limitations under the License. # limitations under the License.
import logging import logging
import os
import random import random
from unittest.mock import patch
import numpy
import pytest import pytest
from common.proto.dbscanserving_pb2 import DetectionRequest, DetectionResponse, Sample from common.proto.dbscanserving_pb2 import DetectionRequest, DetectionResponse, Sample
from dbscanserving.client.DbscanServingClient import DbscanServingClient from dbscanserving.client.DbscanServingClient import DbscanServingClient
...@@ -40,8 +41,16 @@ def dbscanserving_service(): ...@@ -40,8 +41,16 @@ def dbscanserving_service():
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def dbscanserving_client(): def dbscanserving_client():
_client = DbscanServingClient(host="127.0.0.1", port=port) with patch.dict(
yield _client os.environ,
{
"DBSCANSERVINGSERVICE_SERVICE_HOST": "127.0.0.1",
"DBSCANSERVINGSERVICE_SERVICE_PORT_GRPC": str(port),
},
clear=True,
):
_client = DbscanServingClient()
yield _client
_client.close() _client.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment