diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-06-14 16:42:14 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-06-14 16:42:14 -0400 |
| commit | e15d58695d6eff9a1d53e31e5ae3666434a4a1af (patch) | |
| tree | c1000fa1ff38be1cf1070f0f040b811ff374b65b /lib/sqlalchemy/testing/fixtures.py | |
| parent | a8c6cce404caf4a9c20faefc8f11a3e37db3ea05 (diff) | |
| download | sqlalchemy-e15d58695d6eff9a1d53e31e5ae3666434a4a1af.tar.gz | |
- Add a new le_() assertion for less than or equals
- fix TablesTest to use the bind that we've returned from setup_bind()
to emit DELETE statements
Diffstat (limited to 'lib/sqlalchemy/testing/fixtures.py')
| -rw-r--r-- | lib/sqlalchemy/testing/fixtures.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/sqlalchemy/testing/fixtures.py b/lib/sqlalchemy/testing/fixtures.py index 7b421952f..e16bc77c0 100644 --- a/lib/sqlalchemy/testing/fixtures.py +++ b/lib/sqlalchemy/testing/fixtures.py @@ -134,13 +134,14 @@ class TablesTest(TestBase): def _teardown_each_tables(self): # no need to run deletes if tables are recreated on setup if self.run_define_tables != 'each' and self.run_deletes == 'each': - for table in reversed(self.metadata.sorted_tables): - try: - table.delete().execute().close() - except sa.exc.DBAPIError as ex: - util.print_( - ("Error emptying table %s: %r" % (table, ex)), - file=sys.stderr) + with self.bind.connect() as conn: + for table in reversed(self.metadata.sorted_tables): + try: + conn.execute(table.delete()) + except sa.exc.DBAPIError as ex: + util.print_( + ("Error emptying table %s: %r" % (table, ex)), + file=sys.stderr) def setup(self): self._setup_each_tables() |
