bito-code-review[bot] commented on code in PR #44704:
URL: https://github.com/apache/superset/pull/44704#discussion_r4111328297
##########
tests/unit_tests/db_engine_specs/test_oracle.py:
##########
@@ -128,3 +128,50 @@ def test_denormalize_name(name: str, expected_result: str):
from superset.db_engine_specs.oracle import OracleEngineSpec as spec #
noqa: N813
assert spec.denormalize_name(oracle.dialect(), name) == expected_result
+
+
+def test_get_cancel_query_id() -> None:
+ from superset.db_engine_specs.oracle import OracleEngineSpec
+ from superset.models.sql_lab import Query
+
+ cursor = mock.Mock()
+ cursor.fetchone.return_value = (162, 53643, 1)
+ assert OracleEngineSpec.get_cancel_query_id(cursor, Query()) ==
"162,53643,1"
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Uninstantiated SQLAlchemy model</b></div>
<div id="fix">
`Query()` is passed to `OracleEngineSpec.get_cancel_query_id`, but
`superset.models.sql_lab.Query` is a SQLAlchemy model whose `__init__` requires
a `sqlalchemy.orm.Session` (see `Query.__init__(self, self.session)` in
`superset/models/sql_lab.py`). Instantiating it bare raises `TypeError:
__init__() missing 1 required positional argument: 'session'`, so this test
errors before reaching the assertion. Use a `mock.Mock()` for the query
argument instead, as the spec methods never touch it. Same issue applies to
lines 149, 157, 167 and 176.
</div>
</div>
<small><i>Code Review Run #7ee646</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]