]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
a myriad of close_first calls to get sql.alltests to run
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 Mar 2009 20:54:10 +0000 (20:54 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 Mar 2009 20:54:10 +0000 (20:54 +0000)
test/engine/execute.py
test/sql/functions.py
test/sql/labels.py
test/sql/query.py
test/sql/testtypes.py
test/sql/unicode.py
test/testlib/engines.py

index 9d9a57e7c068cd04bf18fb272bddb588023ce8d7..f41d401c6a3f50b9c10c42894216dac5df33beaf 100644 (file)
@@ -18,8 +18,10 @@ class ExecuteTest(TestBase):
         )
         metadata.create_all()
 
+    @engines.close_first
     def tearDown(self):
         testing.db.connect().execute(users.delete())
+        
     def tearDownAll(self):
         metadata.drop_all()
 
index 1519575036901bcb97588f3d96316f739ec6d9d1..9c61617fc6c7508f41eb2041575a723f612108da 100644 (file)
@@ -180,7 +180,10 @@ class CompileTest(TestBase, AssertsCompiledSQL):
 
 
 class ExecuteTest(TestBase):
-
+    @engines.close_first
+    def tearDown(self):
+        pass
+        
     def test_standalone_execute(self):
         x = testing.db.func.current_date().execute().scalar()
         y = testing.db.func.current_date().select().execute().scalar()
@@ -202,6 +205,7 @@ class ExecuteTest(TestBase):
             conn.close()
         assert (x == y == z) is True
 
+    @engines.close_first
     def test_update(self):
         """
         Tests sending functions and SQL expressions to the VALUES and SET
index 94ee20342e6ac7cb5d39c98c06a3337920c773ba..39493e8b816732ec10590d656fb180a57844e403 100644 (file)
@@ -34,6 +34,7 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL):
         maxlen = testing.db.dialect.max_identifier_length
         testing.db.dialect.max_identifier_length = IDENT_LENGTH
 
+    @engines.close_first
     def tearDown(self):
         table1.delete().execute()
 
index 700b2ca5f626f9ef0cf2180f7e2c7aca4e7b7532..b124428c63d64541a6cd3e78e9f712f37b04d0a9 100644 (file)
@@ -26,6 +26,7 @@ class QueryTest(TestBase):
         )
         metadata.create_all()
 
+    @engines.close_first
     def tearDown(self):
         addresses.delete().execute()
         users.delete().execute()
@@ -879,7 +880,11 @@ class CompoundTest(TestBase):
             dict(col2="t3col2r2", col3="bbb", col4="aaa"),
             dict(col2="t3col2r3", col3="ccc", col4="bbb"),
         ])
-
+        
+    @engines.close_first
+    def tearDown(self):
+        pass
+        
     def tearDownAll(self):
         metadata.drop_all()
 
index 74883cafa3f107f78ab1a2450f765a7a8990cca6..e11810f5f34d86e176ee04ecc0b8c60eb923514a 100644 (file)
@@ -308,6 +308,7 @@ class UnicodeTest(TestBase, AssertsExecutionResults):
     def tearDownAll(self):
         metadata.drop_all()
 
+    @engines.close_first
     def tearDown(self):
         unicode_table.delete().execute()
 
@@ -405,6 +406,7 @@ class BinaryTest(TestBase, AssertsExecutionResults):
         )
         binary_table.create()
 
+    @engines.close_first
     def tearDown(self):
         binary_table.delete().execute()
 
@@ -691,6 +693,7 @@ class NumericTest(TestBase, AssertsExecutionResults):
     def tearDownAll(self):
         metadata.drop_all()
 
+    @engines.close_first
     def tearDown(self):
         numeric_table.delete().execute()
 
@@ -764,6 +767,7 @@ class IntervalTest(TestBase, AssertsExecutionResults):
             )
         metadata.create_all()
 
+    @engines.close_first
     def tearDown(self):
         interval_table.delete().execute()
 
index c5002aaffb2fc9445661fd1e046484f0319064f0..d0e4017b148a54bd857aa46847da927e38878311 100644 (file)
@@ -56,6 +56,7 @@ class UnicodeSchemaTest(TestBase):
                        )
         metadata.create_all()
 
+    @engines.close_first
     def tearDown(self):
         if metadata.tables:
             t3.delete().execute()
index 44e6ad96a04cc502ea0cb6ac253af8bb6c00effc..86c1944788c7cc42add13bd4c9898cfddd2ff877 100644 (file)
@@ -39,7 +39,7 @@ class ConnectionKiller(object):
 testing_reaper = ConnectionKiller()
 
 def drop_all_tables(metadata):
-    testing_reaper.rollback_all()
+    testing_reaper.close_all()
     metadata.drop_all()
     
 def assert_conns_closed(fn):
@@ -60,6 +60,14 @@ def rollback_open_connections(fn):
             testing_reaper.rollback_all()
     return _function_named(decorated, fn.__name__)
 
+def close_first(fn):
+    """Decorator that closes all connections before fn execution."""
+    def decorated(*args, **kw):
+        testing_reaper.close_all()
+        fn(*args, **kw)
+    return _function_named(decorated, fn.__name__)
+    
+    
 def close_open_connections(fn):
     """Decorator that closes all connections after fn execution."""