You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/10/25 16:27:04 UTC

[airflow] branch master updated: Fix example DAGs tests + add sanity checks (#11840)

This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 998bb0d  Fix example DAGs tests + add sanity checks (#11840)
998bb0d is described below

commit 998bb0d5fc7287c211cd438863ee3b543f409d56
Author: Kamil BreguĊ‚a <mi...@users.noreply.github.com>
AuthorDate: Sun Oct 25 17:25:52 2020 +0100

    Fix example DAGs tests + add sanity checks (#11840)
---
 tests/core/test_example_dags.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/core/test_example_dags.py b/tests/core/test_example_dags.py
index 6319bb9..0261a43 100644
--- a/tests/core/test_example_dags.py
+++ b/tests/core/test_example_dags.py
@@ -23,7 +23,7 @@ from airflow.models import DagBag
 from tests.test_utils.asserts import assert_queries_count
 
 ROOT_FOLDER = os.path.realpath(
-    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)
+    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir)
 )
 
 NO_DB_QUERY_EXCEPTION = [
@@ -33,7 +33,8 @@ NO_DB_QUERY_EXCEPTION = [
 
 class TestExampleDags(unittest.TestCase):
     def test_should_be_importable(self):
-        example_dags = glob(f"{ROOT_FOLDER}/airflow/**/example_dags/example_*.py", recursive=True)
+        example_dags = list(glob(f"{ROOT_FOLDER}/airflow/**/example_dags/example_*.py", recursive=True))
+        self.assertNotEqual(0, len(example_dags))
         for filepath in example_dags:
             relative_filepath = os.path.relpath(filepath, ROOT_FOLDER)
             with self.subTest(f"File {relative_filepath} should contain dags"):
@@ -51,6 +52,7 @@ class TestExampleDags(unittest.TestCase):
             for dag_file in example_dags
             if any(not dag_file.endswith(e) for e in NO_DB_QUERY_EXCEPTION)
         ]
+        self.assertNotEqual(0, len(example_dags))
         for filepath in example_dags:
             relative_filepath = os.path.relpath(filepath, ROOT_FOLDER)
             with self.subTest(f"File {relative_filepath} shouldn't do database queries"):