bito-code-review[bot] commented on code in PR #44666:
URL: https://github.com/apache/superset/pull/44666#discussion_r4113397932
##########
tests/unit_tests/views/test_error_handling.py:
##########
@@ -293,6 +303,179 @@ def
test_html_accept_serves_branded_error_page_not_raw_json(self):
mock_send_file.assert_called_once()
+class TestShowHttpException:
+ """
+ Client-side HTTP errors are not server faults and must not log tracebacks.
+ """
+
+ def _build_app_with_handlers(self, error: HTTPException) -> Flask:
+ test_app = Flask(__name__)
+ test_app.config["DEBUG"] = False
+ Babel(test_app)
+ set_app_error_handlers(test_app)
+
+ @test_app.route("/http-error")
+ def http_error_view() -> FlaskResponse:
+ raise error
+
+ return test_app
+
+ @staticmethod
+ def _handler_records(
+ caplog: pytest.LogCaptureFixture,
+ ) -> list[logging.LogRecord]:
+ return [
+ record
+ for record in caplog.records
+ if record.name == "superset.views.error_handling"
+ ]
+
+ def test_routing_404_logs_no_warning_and_no_traceback(
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing test docstrings</b></div>
<div id="fix">
Seven new test methods in `TestShowHttpException` (all but
`test_view_404_logs_one_debug_line_with_path_and_no_traceback`) lack
docstrings, unlike the sibling classes' style and BITO rule 12148. Add one-line
docstrings stating scenario and expected behavior, e.g. "Routing 404 logs one
DEBUG line without traceback."
</div>
</div>
<small><i>Code Review Run #730c61</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]