File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ def mock_grpc_future(
15
15
grpc_future .exception .return_value = exception
16
16
grpc_future .running .return_value = running
17
17
grpc_future .result .return_value = result
18
+ if exception :
19
+ grpc_future .result .side_effect = exception
18
20
return grpc_future
19
21
20
22
@@ -309,6 +311,7 @@ def test_result_catch_grpc_exceptions(self, mocker):
309
311
def test_exception_when_done_maps_grpc_exception (self , mocker ):
310
312
grpc_future = mock_grpc_future (mocker , done = True )
311
313
grpc_future .exception .return_value = FakeGrpcError (mocker )
314
+ grpc_future .result .side_effect = grpc_future .exception .return_value
312
315
313
316
future = PineconeGrpcFuture (grpc_future )
314
317
@@ -467,6 +470,7 @@ def test_concurrent_futures_wait_first_exception(self, mocker):
467
470
468
471
grpc_future2 = mock_grpc_future (mocker , done = True )
469
472
grpc_future2 .exception .return_value = Exception ("Simulated gRPC error" )
473
+ grpc_future2 .result .side_effect = grpc_future2 .exception .return_value
470
474
future2 = PineconeGrpcFuture (grpc_future2 )
471
475
472
476
from concurrent .futures import wait , FIRST_EXCEPTION
You can’t perform that action at this time.
0 commit comments