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 2019/09/03 16:18:07 UTC

[GitHub] [airflow] ashb commented on a change in pull request #5358: [AIRFLOW-4085] FileSensor - adding wildcard option

ashb commented on a change in pull request #5358: [AIRFLOW-4085] FileSensor - adding wildcard option
URL: https://github.com/apache/airflow/pull/5358#discussion_r320360901
 
 

 ##########
 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,
+                     ignore_ti_state=True)
+
+    def test_subdirectory_not_empty(self):
+        suffix = '.txt'
+        dir_ = tempfile.mkdtemp()
 
 Review comment:
   Cool if that passes then all's good. I just thought it _would_ fail. This is why we have computers check style and not humans 😁 

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