You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/10 12:16:51 UTC

[GitHub] [airflow] ashb commented on a change in pull request #7620: [AIRFLOW-6402] Fix SSH Operator Exception

ashb commented on a change in pull request #7620: [AIRFLOW-6402] Fix SSH Operator Exception
URL: https://github.com/apache/airflow/pull/7620#discussion_r390272656
 
 

 ##########
 File path: tests/contrib/operators/test_ssh_operator.py
 ##########
 @@ -70,6 +70,24 @@ def test_hook_created_correctly(self):
         self.assertEqual(TIMEOUT, task.ssh_hook.timeout)
         self.assertEqual(SSH_ID, task.ssh_hook.ssh_conn_id)
 
+    def test_empty_command_is_none(self):
+        from airflow.exceptions import AirflowException
+        TIMEOUT = 20
+        COMMAND = None
+        task = SSHOperator(
+            task_id="test",
+            command=COMMAND,
+            dag=self.dag,
+            timeout=TIMEOUT,
+            ssh_conn_id="ssh_default"
+        )
+        self.assertIsNone(task.command)
+        if six.PY2:
 
 Review comment:
   And anyway, in this specific case there is a dedicated way in six to do it:
   
   ```python
               six.assertRaisesRegex(AirflowException,
                                     "SSH command not specified. Aborting.$",
                                     task.execute, None)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services