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 2021/11/30 04:55:06 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #19639: Remove `allowed_conn_types` from SqlSensor

uranusjr commented on a change in pull request #19639:
URL: https://github.com/apache/airflow/pull/19639#discussion_r758930299



##########
File path: tests/sensors/test_sql_sensor.py
##########
@@ -86,8 +86,8 @@ def test_sql_sensor_postgres(self):
         )
         op2.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, ignore_ti_state=True)
 
-    @mock.patch('airflow.sensors.sql.BaseHook')
-    def test_sql_sensor_postgres_poke(self, mock_hook):
+    def test_sql_sensor_postgres_poke(self):
+        mock_hook = mock.MagicMock(spec=BaseHook)

Review comment:
       I think you need to do this instead (same for all other tests)
   
   ```suggestion
       @mock.patch('airflow.sensors.sql.BaseHook', new_callable=mock.MagicMock, spec=True)
       def test_sql_sensor_postgres_poke(self, mock_hook):
   ```
   
   `spec=True` is the same as `spec=BaseHook` without needing to import the class.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org