This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8e39da38faf Remove caplog from Livy tests (#46272)
8e39da38faf is described below

commit 8e39da38faf2b5306f01e9bb51e76a2ce03c33f1
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Jan 30 02:36:48 2025 +0100

    Remove caplog from Livy tests (#46272)
    
    Similarly to #46263 - there is no real value in keeping tests for
    logs in Livy - and caplog tests are known to be super vulnerable
    to side-effects from other tests. Since those tests add no value,
    we should just remove them without replacement.
---
 providers/tests/apache/livy/operators/test_livy.py | 55 ----------------------
 1 file changed, 55 deletions(-)

diff --git a/providers/tests/apache/livy/operators/test_livy.py 
b/providers/tests/apache/livy/operators/test_livy.py
index d9351007ec7..d83af041804 100644
--- a/providers/tests/apache/livy/operators/test_livy.py
+++ b/providers/tests/apache/livy/operators/test_livy.py
@@ -16,7 +16,6 @@
 # under the License.
 from __future__ import annotations
 
-import logging
 from unittest.mock import MagicMock, patch
 
 import pytest
@@ -148,32 +147,6 @@ class TestLivyOperator:
 
         mock_delete.assert_called_once_with(BATCH_ID)
 
-    @patch(
-        
"airflow.providers.apache.livy.operators.livy.LivyHook.get_batch_state",
-        return_value=BatchState.SUCCESS,
-    )
-    
@patch("airflow.providers.apache.livy.operators.livy.LivyHook.get_batch_logs", 
return_value=LOG_RESPONSE)
-    @patch("airflow.providers.apache.livy.operators.livy.LivyHook.post_batch", 
return_value=BATCH_ID)
-    @patch("airflow.providers.apache.livy.operators.livy.LivyHook.get_batch", 
return_value=GET_BATCH)
-    def test_log_dump(self, mock_get_batch, mock_post, mock_get_logs, 
mock_get, caplog):
-        task = LivyOperator(
-            livy_conn_id="livyunittest",
-            file="sparkapp",
-            dag=self.dag,
-            task_id="livy_example",
-            polling_interval=1,
-        )
-        caplog.clear()
-        with caplog.at_level(level=logging.INFO, logger=task.hook.log.name):
-            task.execute(context=self.mock_context)
-
-        assert "first_line" in caplog.messages
-        assert "second_line" in caplog.messages
-        assert "third_line" in caplog.messages
-
-        mock_get.assert_called_once_with(BATCH_ID, retry_args=None)
-        mock_get_logs.assert_called_once_with(BATCH_ID, 0, 100)
-
     @patch(
         
"airflow.providers.apache.livy.operators.livy.LivyHook.dump_batch_logs",
         return_value=None,
@@ -319,34 +292,6 @@ class TestLivyOperator:
 
         mock_delete.assert_called_once_with(BATCH_ID)
 
-    @patch(
-        
"airflow.providers.apache.livy.operators.livy.LivyHook.get_batch_state",
-        return_value=BatchState.SUCCESS,
-    )
-    
@patch("airflow.providers.apache.livy.operators.livy.LivyHook.get_batch_logs", 
return_value=LOG_RESPONSE)
-    @patch("airflow.providers.apache.livy.operators.livy.LivyHook.post_batch", 
return_value=BATCH_ID)
-    @patch("airflow.providers.apache.livy.operators.livy.LivyHook.get_batch", 
return_value=GET_BATCH)
-    def test_log_dump_deferrable(self, mock_get_batch, mock_post, 
mock_get_logs, mock_get, caplog):
-        task = LivyOperator(
-            livy_conn_id="livyunittest",
-            file="sparkapp",
-            dag=self.dag,
-            task_id="livy_example",
-            polling_interval=1,
-            deferrable=True,
-        )
-        caplog.clear()
-
-        with caplog.at_level(level=logging.INFO, logger=task.hook.log.name):
-            task.execute(context=self.mock_context)
-
-            assert "first_line" in caplog.messages
-            assert "second_line" in caplog.messages
-            assert "third_line" in caplog.messages
-
-        mock_get.assert_called_once_with(BATCH_ID, retry_args=None)
-        mock_get_logs.assert_called_once_with(BATCH_ID, 0, 100)
-
     @patch("airflow.providers.apache.livy.operators.livy.LivyHook.get_batch", 
return_value={"appId": APP_ID})
     @patch("airflow.providers.apache.livy.operators.livy.LivyHook.post_batch", 
return_value=BATCH_ID)
     def test_execute_complete_success(self, mock_post, mock_get):

Reply via email to