summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-01-02 23:26:25 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2021-01-02 23:26:25 +0000
commit3f72c2c6cbc76506af57f136542f30bf68261898 (patch)
tree27f771be69b8b23e87ccb554a7f9aa9f1d24008e /lib/sqlalchemy/testing
parent0d7f4c63669a0c43bf726d733c69f7aca6407f81 (diff)
parent0679b4f1fdd82b2456292e9cdd7a971209755685 (diff)
downloadsqlalchemy-3f72c2c6cbc76506af57f136542f30bf68261898.tar.gz
Merge "Further attempts to repair SQL server temp table issue"
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)