bito-code-review[bot] commented on code in PR #39646:
URL: https://github.com/apache/superset/pull/39646#discussion_r3238701797


##########
tests/unit_tests/db_engine_specs/test_base.py:
##########
@@ -969,6 +969,10 @@ def test_get_oauth2_token_without_pkce(mocker: 
MockerFixture) -> None:
     """
     from superset.db_engine_specs.base import BaseEngineSpec
 
+    mocker.patch(
+        "superset.db_engine_specs.base.socket.getaddrinfo",
+        return_value=[(2, 1, 6, "", ("93.184.215.14", 0))],
+    )

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicated mock setup</b></div>
   <div id="fix">
   
   The same socket.getaddrinfo mock is duplicated across 6 test functions 
(test_get_oauth2_token_without_pkce, test_get_oauth2_token_with_pkce, 
test_get_oauth2_token_additional_params, test_get_oauth2_fresh_token_success, 
test_get_oauth2_fresh_token_raises_on_auth_error, 
test_get_oauth2_fresh_token_raises_on_server_error). This creates maintenance 
risk if the mock needs to change. Consider using a pytest fixture like 
@pytest.fixture def mock_getaddrinfo(mocker): return 
mocker.patch("superset.db_engine_specs.base.socket.getaddrinfo", 
return_value=[(2, 1, 6, "", ("93.184.215.14", 0))]) and applying it to the 
relevant tests.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #33dcf6</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to