Commits

Mike Bayer committed 3076551

fixed some imports, transaction hanging open

Comments (0)

Files changed (5)

lib/sqlalchemy/orm/strategies.py

 
 """sqlalchemy.orm.interfaces.LoaderStrategy implementations, and related MapperOptions."""
 
-from sqlalchemy import sql, schema, util, attributes, exceptions, sql_util, logging
+from sqlalchemy import sql, schema, util, exceptions, sql_util, logging
 import mapper, query
 from interfaces import *
 import session as sessionlib

test/base/dependency.py

 from testbase import PersistTest
-import sqlalchemy.orm.topological as topological
+import sqlalchemy.topological as topological
 import unittest, sys, os
 
 

test/orm/inheritance.py

 import testbase
 from sqlalchemy import *
 import string
-import sqlalchemy.attributes as attr
 import sys
 
 class Principal( object ):

test/orm/manytomany.py

 import testbase
 from sqlalchemy import *
 import string
-import sqlalchemy.attributes as attr
 
 class Place(object):
     '''represents a place'''

test/orm/session.py

 
     def test_close_two(self):
         c = testbase.db.connect()
-        class User(object):pass
-        mapper(User, users)
-        s = create_session(bind_to=c)
-        tran = s.create_transaction()
-        s.save(User())
-        s.flush()
-        c.execute("select * from users")
-        u = User()
-        s.save(u)
-        s.user_name = 'some user'
-        s.flush()
-        u = User()
-        s.save(u)
-        s.user_name = 'some other user'
-        s.flush()
-        assert s.transaction is tran
-        tran.close()
-
+        try:
+            class User(object):pass
+            mapper(User, users)
+            s = create_session(bind_to=c)
+            tran = s.create_transaction()
+            s.save(User())
+            s.flush()
+            c.execute("select * from users")
+            u = User()
+            s.save(u)
+            s.user_name = 'some user'
+            s.flush()
+            u = User()
+            s.save(u)
+            s.user_name = 'some other user'
+            s.flush()
+            assert s.transaction is tran
+            tran.close()
+        finally:
+            c.close()
+        
 class OrphanDeletionTest(AssertMixin):
 
     def setUpAll(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.