You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/09/21 21:44:24 UTC

[GitHub] Fokko commented on a change in pull request #3935: [AIRFLOW-1390] Update Alembic to 0.9

Fokko commented on a change in pull request #3935: [AIRFLOW-1390] Update Alembic to 0.9
URL: https://github.com/apache/incubator-airflow/pull/3935#discussion_r219635019
 
 

 ##########
 File path: tests/operators/operators.py
 ##########
 @@ -47,6 +47,13 @@ def setUp(self):
         dag = DAG(TEST_DAG_ID, default_args=args)
         self.dag = dag
 
+    def tearDown(self):
+        from airflow.hooks.mysql_hook import MySqlHook
+        drop_tables = {'test_mysql_to_mysql', 'test_airflow'}
+        with MySqlHook().get_conn() as conn:
+            for table in drop_tables:
+                conn.execute("DROP TABLE IF EXISTS {}".format(table))
 
 Review comment:
   Previously the tables created by the tests would still exists after the test since there was no cleaning up. This interferes with the test that compares the Alembic models with the actual database.
   
   For Travis we run all the tests exactly once, but we still want to clean up the state (tables in the database) afterwards to exit in a consistent state. Therefore I've added the some cleaning in the `tearDown` step of the tests.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services