diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-28 17:59:48 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-28 18:10:42 -0500 |
commit | 14b1e6fe8e18d139846c1aba6761d4eea3dc25c3 (patch) | |
tree | 5b85691d070eab0e46257428a8bd6f07a4925267 | |
parent | 13dfc532ac02657d75da40cc52d97b3b50a6bcfe (diff) | |
download | sqlalchemy-14b1e6fe8e18d139846c1aba6761d4eea3dc25c3.tar.gz |
- use a StaticPool for componentreflectiontest to ensure
temp tables are reflectable on the same session they were
created
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_reflection.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 288a85973..4a3dd9024 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -40,6 +40,15 @@ class ComponentReflectionTest(fixtures.TablesTest): __backend__ = True @classmethod + def setup_bind(cls): + if config.requirements.independent_connections.enabled: + from sqlalchemy import pool + return engines.testing_engine( + options=dict(poolclass=pool.StaticPool)) + else: + return config.db + + @classmethod def define_tables(cls, metadata): cls.define_reflected_tables(metadata, None) if testing.requires.schemas.enabled: @@ -104,7 +113,7 @@ class ComponentReflectionTest(fixtures.TablesTest): # temp table fixture if testing.against("oracle"): kw = { - 'prefixes': ["GLOBAL TEMPORARY"], + 'prefixes': ["TEMPORARY"], 'oracle_on_commit': 'PRESERVE ROWS' } else: @@ -202,7 +211,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.temp_table_names def test_get_temp_table_names(self): - insp = inspect(testing.db) + insp = inspect(self.bind) temp_table_names = insp.get_temp_table_names() eq_(sorted(temp_table_names), ['user_tmp']) @@ -210,7 +219,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.temp_table_names @testing.requires.temporary_views def test_get_temp_view_names(self): - insp = inspect(self.metadata.bind) + insp = inspect(self.bind) temp_table_names = insp.get_temp_view_names() eq_(sorted(temp_table_names), ['user_tmp_v']) @@ -348,7 +357,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.temp_table_reflection def test_get_temp_table_columns(self): - meta = MetaData(testing.db) + meta = MetaData(self.bind) user_tmp = self.tables.user_tmp insp = inspect(meta.bind) cols = insp.get_columns('user_tmp') @@ -361,7 +370,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.view_column_reflection @testing.requires.temporary_views def test_get_temp_view_columns(self): - insp = inspect(self.metadata.bind) + insp = inspect(self.bind) cols = insp.get_columns('user_tmp_v') eq_( [col['name'] for col in cols], @@ -503,7 +512,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.temp_table_reflection @testing.requires.unique_constraint_reflection def test_get_temp_table_unique_constraints(self): - insp = inspect(self.metadata.bind) + insp = inspect(self.bind) reflected = insp.get_unique_constraints('user_tmp') for refl in reflected: # Different dialects handle duplicate index and constraints @@ -513,7 +522,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.temp_table_reflection def test_get_temp_table_indexes(self): - insp = inspect(self.metadata.bind) + insp = inspect(self.bind) indexes = insp.get_indexes('user_tmp') for ind in indexes: ind.pop('dialect_options', None) |