]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- commented out auto-rollback of attributes for now, added [ticket:705] with the...
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 Jul 2007 22:54:07 +0000 (22:54 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 Jul 2007 22:54:07 +0000 (22:54 +0000)
- added "drop_all()" at the start of all unittest runs; see if that helps some of the carwrecks we have

lib/sqlalchemy/orm/session.py
test/testlib/config.py

index d336c57277159432be872beaae1de7c8bc75fc71..b957f822f62796c38eaa5e3b88d5bd4e3b069742 100644 (file)
@@ -178,7 +178,11 @@ class Session(object):
             pass
         else:
             self.transaction = self.transaction.rollback()
-        attribute_manager.rollback(*self.identity_map.values())
+        # TODO: we can rollback attribute values.  however
+        # we would want to expand attributes.py to be able to save *two* rollback points, one to the 
+        # last flush() and the other to when the object first entered the transaction.
+        # [ticket:705]
+        #attribute_manager.rollback(*self.identity_map.values())
         if self.transaction is None and self.transactional:
             self.begin()
             
index 987832b11c3973715a71a5e3919ca85de78fde03..db58718ceada19153aeaf9309e982ca9251f0be2 100644 (file)
@@ -178,7 +178,7 @@ def _require(options, file_config):
 post_configure['require'] = _require
 
 def _create_testing_engine(options, file_config):
-    from sqlalchemy import engine
+    from sqlalchemy import engine, schema
     global db, db_type
     engine_opts = {}
     if options.serverside:
@@ -194,6 +194,10 @@ def _create_testing_engine(options, file_config):
         db = engine.create_engine(db_uri, **engine_opts)
     db_type = db.name
 
+    print "Dropping existing tables in database: " + db_uri
+    md = schema.MetaData(db, reflect=True)
+    md.drop_all()
+    
     # decorate the dialect's create_execution_context() method
     # to produce a wrapper
     from testlib.testing import ExecutionContextWrapper