diff --git a/tests/dags/.airflowignore b/tests/dags/.airflowignore new file mode 100644 index 0000000000000..93361c17e24d8 --- /dev/null +++ b/tests/dags/.airflowignore @@ -0,0 +1 @@ +.*_invalid.* diff --git a/tests/jobs.py b/tests/jobs.py index f106bafaabcd3..062a69661f787 100644 --- a/tests/jobs.py +++ b/tests/jobs.py @@ -3319,16 +3319,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. """