kaxil closed pull request #3973: [AIRFLOW-XXX] Don't spam test logs with "bad
cron expression" messages
URL: https://github.com/apache/incubator-airflow/pull/3973
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/tests/dags/.airflowignore b/tests/dags/.airflowignore
new file mode 100644
index 0000000000..93361c17e2
--- /dev/null
+++ b/tests/dags/.airflowignore
@@ -0,0 +1 @@
+.*_invalid.*
diff --git a/tests/jobs.py b/tests/jobs.py
index e18a87e6cf..bb714bd201 100644
--- a/tests/jobs.py
+++ b/tests/jobs.py
@@ -3285,16 +3285,22 @@ def test_list_py_file_paths(self):
[JIRA-1357] Test the 'list_py_file_paths' function used by the
scheduler to list and load DAGs.
"""
- detected_files = []
- expected_files = []
+ detected_files = set()
+ expected_files = set()
+ # No_dags is empty, _invalid_ is ignored by .airflowignore
+ ignored_files = [
+ 'no_dags.py',
+ 'test_invalid_cron.py',
+ 'test_zip_invalid_cron.zip',
+ ]
for file_name in os.listdir(TEST_DAGS_FOLDER):
if file_name.endswith('.py') or file_name.endswith('.zip'):
- if file_name not in ['no_dags.py']:
- expected_files.append(
+ if file_name not in ignored_files:
+ expected_files.add(
'{}/{}'.format(TEST_DAGS_FOLDER, file_name))
for file_path in list_py_file_paths(TEST_DAGS_FOLDER):
- detected_files.append(file_path)
- self.assertEqual(sorted(detected_files), sorted(expected_files))
+ detected_files.add(file_path)
+ self.assertEqual(detected_files, expected_files)
def test_reset_orphaned_tasks_nothing(self):
"""Try with nothing. """
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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