zacharya19 commented on a change in pull request #5358: [AIRFLOW-4085]
FileSensor - adding wildcard option
URL: https://github.com/apache/airflow/pull/5358#discussion_r318224678
##########
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:
The pylint scripts in the CONTRIBUTING.md doesn't exists, so I'm not quite
sure how do you guys run pylint, but by running it with this
[pylintrc](https://github.com/apache/airflow/blob/master/pylintrc), I get the
opposite.
As far as I know, according to PEP8, single leading underscore is the right
way to avoid collisions with python builtin functions and keywords (in this
case - `dir`).
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services