File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
sdks/python/apache_beam/ml/inference Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,17 @@ class ParseInvokeResponseTest(unittest.TestCase):
5353 def _create_handler_with_invoke_route (self , invoke_route = "/test" ):
5454 """Creates a mock handler with invoke_route for testing."""
5555 import unittest .mock as mock
56+ # Mock both _retrieve_endpoint and aiplatform.init to prevent test
57+ # pollution of global aiplatform state
5658 with mock .patch .object (VertexAIModelHandlerJSON ,
5759 '_retrieve_endpoint' ,
5860 return_value = None ):
59- handler = VertexAIModelHandlerJSON (
60- endpoint_id = "1" ,
61- project = "testproject" ,
62- location = "us-central1" ,
63- invoke_route = invoke_route )
61+ with mock .patch ('google.cloud.aiplatform.init' ):
62+ handler = VertexAIModelHandlerJSON (
63+ endpoint_id = "1" ,
64+ project = "testproject" ,
65+ location = "us-central1" ,
66+ invoke_route = invoke_route )
6467 return handler
6568
6669 def test_parse_invoke_response_with_predictions_key (self ):
You can’t perform that action at this time.
0 commit comments