- add some connection cleanup

This commit is contained in:
Mike Bayer 2014-11-09 12:33:26 -05:00
parent 8b8fe7b3c3
commit 9abd572c70
3 changed files with 10 additions and 4 deletions

View File

@ -58,7 +58,7 @@ class AutogenTest(object):
clear_staging_env()
def setUp(self):
conn = self.bind.connect()
self.conn = conn = self.bind.connect()
ctx_opts = {
'compare_type': True,
'compare_server_default': True,
@ -83,6 +83,9 @@ class AutogenTest(object):
'context': context
}
def tearDown(self):
self.conn.close()
class AutogenFixtureTest(object):

View File

@ -355,8 +355,9 @@ class BatchRoundTripTest(TestBase):
def setUp(self):
self.conn = config.db.connect()
self.metadata = MetaData()
t1 = Table(
'foo', MetaData(),
'foo', self.metadata,
Column('id', Integer, primary_key=True),
Column('data', String(50)),
Column('x', Integer)
@ -377,7 +378,7 @@ class BatchRoundTripTest(TestBase):
self.op = Operations(context)
def tearDown(self):
self.conn.execute("drop table foo")
self.metadata.drop_all(self.conn)
self.conn.close()
def _assert_data(self, data):

View File

@ -319,9 +319,10 @@ class PostgresqlDetectSerialTest(TestBase):
@classmethod
def setup_class(cls):
cls.bind = config.db
cls.conn = cls.bind.connect()
staging_env()
context = MigrationContext.configure(
connection=cls.bind.connect(),
connection=cls.conn,
opts={
'compare_type': True,
'compare_server_default': True
@ -343,6 +344,7 @@ class PostgresqlDetectSerialTest(TestBase):
@classmethod
def teardown_class(cls):
cls.conn.close()
clear_staging_env()
@provide_metadata