test_dag_check.py 544 B

1234567891011121314151617181920212223242526
  1. import unittest
  2. from airflow.models import DagBag,Variable
  3. class TestAllDagIntegrity(unittest.TestCase):
  4. LOAD_SECOND_THRESHOLD = 2
  5. def setUp(self):
  6. self.dagbag = DagBag('dags')
  7. def test_dag_import(self):
  8. self.assertFalse(
  9. len(self.dagbag.import_errors),
  10. 'DAG import errors: {}'.format(
  11. self.dagbag.import_errors))
  12. if __name__=='__main__':
  13. checks = \
  14. unittest.\
  15. TestLoader().\
  16. loadTestsFromTestCase(TestAllDagIntegrity)
  17. unittest.\
  18. TextTestRunner(verbosity=1).\
  19. run(checks)