kacpermuda commented on code in PR #74805:
URL: https://github.com/apache/airflow/pull/74805#discussion_r4379815720


##########
providers/common/sql/tests/unit/common/sql/operators/test_sql_execute.py:
##########
@@ -368,6 +368,40 @@ def get_db_hook(self):
     )
 
 
+def test_openlineage_hook_without_database_info_method_returns_empty_lineage():
+    from airflow.providers.openlineage.extractors import OperatorLineage
+
+    hook = mock.MagicMock(spec=["get_connection", "conn_name_attr", "conn_id"])
+    hook.conn_name_attr = "conn_id"
+    hook.conn_id = "sql_default"
+
+    class SQLExecuteQueryOperatorForTest(SQLExecuteQueryOperator):
+        def get_db_hook(self):
+            return hook
+
+    op = SQLExecuteQueryOperatorForTest(task_id=TASK_ID, sql="SELECT 1;")
+
+    assert op.get_openlineage_facets_on_start() == OperatorLineage()
+
+
+def test_openlineage_attribute_error_from_database_info_is_not_swallowed():
+    hook = mock.MagicMock()

Review Comment:
   Done. Hooks in the new tests use MagicMock(spec=DbApiHook), or an explicit 
spec=[...] list for the “method missing” cases, and the patched loggers use 
autospec.



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