bito-code-review[bot] commented on code in PR #40445:
URL: https://github.com/apache/superset/pull/40445#discussion_r3347981203
##########
tests/unit_tests/initialization_test.py:
##########
@@ -190,6 +190,42 @@ def test_database_uri_doesnt_cache_fallback_values(self):
)
+ @patch("superset.initialization.SupersetAppInitializer.init_views")
+ def test_swagger_ui_inherits_custom_prefix_routing(self, mock_init_views):
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>RuntimeError from unmocked db.session</b></div>
<div id="fix">
The test will raise `RuntimeError: Working outside of application context.`
at line 219 because `configure_fab()` calls
`appbuilder.init_app(self.superset_app, db.session)` where `db` is imported
from `superset.extensions` and `db.session` requires an active Flask
application context. Other tests in this file (e.g., line 47) patch
`superset.extensions.db` to avoid this. Add the missing decorator.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
--- tests/unit_tests/initialization_test.py (lines 193-194) ---
193: + @patch("superset.extensions.db")
@patch("superset.initialization.SupersetAppInitializer.init_views")
def test_swagger_ui_inherits_custom_prefix_routing(self,
mock_init_views):
```
</div>
</details>
</div>
<small><i>Code Review Run #a77674</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]