airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] zacharya19 commented on a change in pull request #5358: [AIRFLOW-4085] FileSensor - adding wildcard option
Date Tue, 27 Aug 2019 18:08:27 GMT
zacharya19 commented on a change in pull request #5358: [AIRFLOW-4085] FileSensor - adding
wildcard option
URL: https://github.com/apache/airflow/pull/5358#discussion_r318222617
 
 

 ##########
 File path: tests/contrib/sensors/test_file_sensor.py
 ##########
 @@ -134,6 +135,56 @@ def test_default_fs_conn_id(self):
             task.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE,
                      ignore_ti_state=True)
 
+    def test_wildcard_file(self):
+        suffix = '.txt'
+        with tempfile.NamedTemporaryFile(suffix=suffix) as tmp:
+            fileglob = os.path.join(os.path.dirname(tmp.name), '*' + suffix)
+            task = FileSensor(
+                task_id='test',
+                filepath=fileglob,
+                fs_conn_id='fs_default',
+                dag=self.dag,
+                timeout=0,
+            )
+            task._hook = self.hook
+            task.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE,
 
 Review comment:
   It does, if the file will not be found (immediately) the sensor will throw AirflowSensorTimeout
and the test will fail.  

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

Mime
View raw message