summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/fixtures.py6
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py7
-rw-r--r--lib/sqlalchemy/testing/provision.py5
3 files changed, 15 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/fixtures.py b/lib/sqlalchemy/testing/fixtures.py
index 54b1cbb46..0ede25176 100644
--- a/lib/sqlalchemy/testing/fixtures.py
+++ b/lib/sqlalchemy/testing/fixtures.py
@@ -206,7 +206,11 @@ class TablesTest(TestBase):
drop_all_tables(self.metadata, self.bind)
# no need to run deletes if tables are recreated on setup
- if self.run_define_tables != "each" and self.run_deletes == "each":
+ if (
+ self.run_define_tables != "each"
+ and self.run_create_tables != "each"
+ and self.run_deletes == "each"
+ ):
with self.bind.begin() as conn:
for table in reversed(
[
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index 34e3c5760..b39015852 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -45,6 +45,7 @@ engines = None
exclusions = None
warnings = None
profiling = None
+provision = None
assertions = None
requirements = None
config = None
@@ -283,12 +284,12 @@ def post_begin():
fn(options, file_config)
# late imports, has to happen after config.
- global util, fixtures, engines, exclusions, assertions
+ global util, fixtures, engines, exclusions, assertions, provision
global warnings, profiling, config, testing
from sqlalchemy import testing # noqa
from sqlalchemy.testing import fixtures, engines, exclusions # noqa
from sqlalchemy.testing import assertions, warnings, profiling # noqa
- from sqlalchemy.testing import config # noqa
+ from sqlalchemy.testing import config, provision # noqa
from sqlalchemy import util # noqa
warnings.setup_filters()
@@ -619,6 +620,8 @@ def start_test_class(cls):
def stop_test_class(cls):
# from sqlalchemy import inspect
# assert not inspect(testing.db).get_table_names()
+
+ provision.stop_test_class(config, config.db, cls)
engines.testing_reaper._stop_test_ctx()
try:
if not options.low_connections:
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py
index 9b5fa0255..aa14a9c1a 100644
--- a/lib/sqlalchemy/testing/provision.py
+++ b/lib/sqlalchemy/testing/provision.py
@@ -301,6 +301,11 @@ def temp_table_keyword_args(cfg, eng):
@register.init
+def stop_test_class(config, db, testcls):
+ pass
+
+
+@register.init
def get_temp_table_name(cfg, eng, base_name):
"""Specify table name for creating a temporary Table.