summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-01-02 11:55:52 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-01-02 11:55:52 -0500
commit0679b4f1fdd82b2456292e9cdd7a971209755685 (patch)
tree36154b350a2734a2300add9450b5a76737cc80c0 /lib/sqlalchemy/testing
parent2581655c545a0cf705e0347e81cd092896d3207c (diff)
downloadsqlalchemy-0679b4f1fdd82b2456292e9cdd7a971209755685.tar.gz
Further attempts to repair SQL server temp table issue
Still having non-reproducible failures where "user_tmp" cannot be dropped. try isolating the table name around config.ident Change-Id: I17e0a9674b22d246f0d52943b850e8f6de223305
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/provision.py3
-rw-r--r--lib/sqlalchemy/testing/suite/test_reflection.py18
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py
index fb3d77dc4..589045453 100644
--- a/lib/sqlalchemy/testing/provision.py
+++ b/lib/sqlalchemy/testing/provision.py
@@ -70,7 +70,8 @@ def setup_config(db_url, options, file_config, follower_ident):
# a symbolic name that tests can use if they need to disambiguate
# names across databases
- config.ident = follower_ident
+ if follower_ident:
+ config.ident = follower_ident
if follower_ident:
configure_follower(cfg, follower_ident)
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py
index f1c573662..bef3abb59 100644
--- a/lib/sqlalchemy/testing/suite/test_reflection.py
+++ b/lib/sqlalchemy/testing/suite/test_reflection.py
@@ -451,7 +451,9 @@ class ComponentReflectionTest(fixtures.TablesTest):
@classmethod
def define_temp_tables(cls, metadata):
kw = temp_table_keyword_args(config, config.db)
- table_name = get_temp_table_name(config, config.db, "user_tmp")
+ table_name = get_temp_table_name(
+ config, config.db, "user_tmp_%s" % config.ident
+ )
user_tmp = Table(
table_name,
metadata,
@@ -477,7 +479,7 @@ class ComponentReflectionTest(fixtures.TablesTest):
"after_create",
DDL(
"create temporary view user_tmp_v as "
- "select * from user_tmp"
+ "select * from user_tmp_%s" % config.ident
),
)
event.listen(user_tmp, "before_drop", DDL("drop view user_tmp_v"))
@@ -564,7 +566,7 @@ class ComponentReflectionTest(fixtures.TablesTest):
def test_get_temp_table_names(self):
insp = inspect(self.bind)
temp_table_names = insp.get_temp_table_names()
- eq_(sorted(temp_table_names), ["user_tmp"])
+ eq_(sorted(temp_table_names), ["user_tmp_%s" % config.ident])
@testing.requires.view_reflection
@testing.requires.temp_table_names
@@ -752,7 +754,9 @@ class ComponentReflectionTest(fixtures.TablesTest):
@testing.requires.temp_table_reflection
def test_get_temp_table_columns(self):
- table_name = get_temp_table_name(config, config.db, "user_tmp")
+ table_name = get_temp_table_name(
+ config, config.db, "user_tmp_%s" % config.ident
+ )
meta = MetaData(self.bind)
user_tmp = self.tables[table_name]
insp = inspect(meta.bind)
@@ -1092,7 +1096,7 @@ class ComponentReflectionTest(fixtures.TablesTest):
@testing.requires.unique_constraint_reflection
def test_get_temp_table_unique_constraints(self):
insp = inspect(self.bind)
- reflected = insp.get_unique_constraints("user_tmp")
+ reflected = insp.get_unique_constraints("user_tmp_%s" % config.ident)
for refl in reflected:
# Different dialects handle duplicate index and constraints
# differently, so ignore this flag
@@ -1110,7 +1114,9 @@ class ComponentReflectionTest(fixtures.TablesTest):
@testing.requires.temp_table_reflect_indexes
def test_get_temp_table_indexes(self):
insp = inspect(self.bind)
- table_name = get_temp_table_name(config, config.db, "user_tmp")
+ table_name = get_temp_table_name(
+ config, config.db, "user_tmp_%s" % config.ident
+ )
indexes = insp.get_indexes(table_name)
for ind in indexes:
ind.pop("dialect_options", None)