Copilot commented on code in PR #12182:
URL: https://github.com/apache/gravitino/pull/12182#discussion_r3644981905


##########
clients/client-python/tests/unittests/test_generic_function.py:
##########
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+
+from gravitino.api.function.function_type import FunctionType
+from gravitino.api.rel.types.types import Types
+from gravitino.api.tag.supports_tags import SupportsTags
+from gravitino.client.generic_function import GenericFunction
+from gravitino.dto.audit_dto import AuditDTO
+from gravitino.dto.function.function_definition_dto import 
FunctionDefinitionDTO
+from gravitino.dto.function.function_dto import FunctionDTO
+from gravitino.namespace import Namespace
+from gravitino.utils.http_client import HTTPClient
+
+
+class TestGenericFunction(unittest.TestCase):
+    _rest_client = HTTPClient("http://localhost:8080";)
+    _function_namespace = Namespace.of(

Review Comment:
   Unit test uses a real HTTPClient pointed at localhost. Even though these 
tests don't currently invoke the client, keeping a concrete URL-backed client 
in unit tests makes it easy to accidentally introduce real network calls later 
(leading to flaky tests) and provides no benefit here. Use a 
Mock(spec=HTTPClient) instead.



##########
clients/client-python/tests/unittests/test_generic_view.py:
##########
@@ -18,13 +18,23 @@
 import unittest
 
 from gravitino.api.rel.dialects import Dialects
+from gravitino.api.tag.supports_tags import SupportsTags
 from gravitino.client.generic_view import GenericView
 from gravitino.dto.audit_dto import AuditDTO
 from gravitino.dto.rel.sql_representation_dto import SQLRepresentationDTO
 from gravitino.dto.rel.view_dto import ViewDTO
+from gravitino.namespace import Namespace
+from gravitino.utils.http_client import HTTPClient
 
 
 class TestGenericView(unittest.TestCase):
+    _rest_client = HTTPClient("http://localhost:8080";)
+    _view_namespace = Namespace.of(

Review Comment:
   Unit test uses a real HTTPClient pointed at localhost. Even though these 
tests don't currently invoke the client, keeping a concrete URL-backed client 
in unit tests makes it easy to accidentally introduce real network calls later 
(leading to flaky tests) and provides no benefit here. Use a 
Mock(spec=HTTPClient) instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to