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

potiuk 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 39ddec9b06 code cov of sequential executor to 90 (#40530)
39ddec9b06 is described below

commit 39ddec9b063e284423e307b2a8a6039525db6520
Author: Lucy Hu <[email protected]>
AuthorDate: Tue Jul 2 02:03:52 2024 -0400

    code cov of sequential executor to 90 (#40530)
---
 tests/executors/test_sequential_executor.py | 32 +++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/executors/test_sequential_executor.py 
b/tests/executors/test_sequential_executor.py
index 46cf768a25..54e2a91703 100644
--- a/tests/executors/test_sequential_executor.py
+++ b/tests/executors/test_sequential_executor.py
@@ -63,3 +63,35 @@ class TestSequentialExecutor:
             ),
         ]
         mock_stats_gauge.assert_has_calls(calls)
+
+    def test_execute_async(self):
+        executor = SequentialExecutor()
+        mock_key = mock.Mock()
+        mock_command = mock.Mock()
+        mock_queue = "mock_queue"
+        mock_executor_config = mock.Mock()
+
+        executor.validate_airflow_tasks_run_command = mock.Mock()
+        executor.execute_async(mock_key, mock_command, mock_queue, 
mock_executor_config)
+
+        
executor.validate_airflow_tasks_run_command.assert_called_once_with(mock_command)
+        assert executor.commands_to_run == [(mock_key, mock_command)]
+
+    @mock.patch("airflow.executors.sequential_executor.subprocess")
+    def test_sync(self, mock_subprocess):
+        executor = SequentialExecutor()
+        executor.commands_to_run = [("key", ["echo", "test_command"])]
+        mock_subprocess.check_call.return_value = 0
+
+        executor.success = mock.Mock()
+        executor.sync()
+        executor.success.assert_called_once_with("key")
+
+        assert executor.commands_to_run == []
+
+    def test_end(self):
+        executor = SequentialExecutor()
+        executor.heartbeat = mock.Mock()
+        executor.end()
+
+        executor.heartbeat.assert_called_once()

Reply via email to