diff options
-rw-r--r-- | tests/test_autogenerate.py | 5 | ||||
-rw-r--r-- | tests/test_batch.py | 5 | ||||
-rw-r--r-- | tests/test_postgresql.py | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/tests/test_autogenerate.py b/tests/test_autogenerate.py index 9f6cc00..e9951a7 100644 --- a/tests/test_autogenerate.py +++ b/tests/test_autogenerate.py @@ -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): diff --git a/tests/test_batch.py b/tests/test_batch.py index bbbb094..0d5edd6 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -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): diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index f1b2c2d..908eec6 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -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 |