ashb closed pull request #4122: [AIRFLOW-3287] Moving DB clean-up code into the
CoreTest.tearDown()
URL: https://github.com/apache/incubator-airflow/pull/4122
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/core.py b/tests/core.py
index 679ddbc125..64195b6349 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -89,19 +89,6 @@
import pickle
-def reset(dag_id=TEST_DAG_ID):
- session = Session()
- tis = session.query(models.TaskInstance).filter_by(dag_id=dag_id)
- tis.delete()
- session.commit()
- session.close()
-
-
-configuration.conf.load_test_config()
-if os.environ.get('KUBERNETES_VERSION') is None:
- reset()
-
-
class OperatorSubclass(BaseOperator):
"""
An operator to test template substitution
@@ -130,6 +117,16 @@ def setUp(self):
self.run_after_loop = self.dag_bash.get_task('run_after_loop')
self.run_this_last = self.dag_bash.get_task('run_this_last')
+ def tearDown(self):
+ if os.environ.get('KUBERNETES_VERSION') is None:
+ session = Session()
+ session.query(models.TaskInstance).filter_by(
+ dag_id=TEST_DAG_ID).delete()
+ session.query(models.TaskFail).filter_by(
+ dag_id=TEST_DAG_ID).delete()
+ session.commit()
+ session.close()
+
def test_schedule_dag_no_previous_runs(self):
"""
Tests scheduling a dag with no previous runs
----------------------------------------------------------------
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