Drop our scoped session sooner to prevent SQLAlchemy re-binding warnings.
authorBrett Smith <brettcsmith@brettcsmith.org>
Sun, 8 Jul 2012 15:00:36 +0000 (11:00 -0400)
committerBrett Smith <brettcsmith@brettcsmith.org>
Sun, 8 Jul 2012 15:00:36 +0000 (11:00 -0400)
mediagoblin/tests/tools.py

index 5b4e3746202cbf9b872e2faff2cbdf1db7de21fc..bf40ea8b5e433861c953f12988990220a48f4888 100644 (file)
@@ -116,6 +116,9 @@ def get_test_app(dump_old_app=True):
     if MGOBLIN_APP and not dump_old_app:
         return MGOBLIN_APP
 
+    Session.rollback()
+    Session.remove()
+
     # Remove and reinstall user_dev directories
     if os.path.exists(TEST_USER_DEV):
         shutil.rmtree(TEST_USER_DEV)
@@ -135,9 +138,6 @@ def get_test_app(dump_old_app=True):
     test_app = loadapp(
         'config:' + TEST_SERVER_CONFIG)
 
-    Session.rollback()
-    Session.remove()
-
     # Re-setup celery
     setup_celery_app(app_config, global_config)