__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)
# temp table fixture
if testing.against("oracle"):
kw = {
- 'prefixes': ["GLOBAL TEMPORARY"],
+ 'prefixes': ["TEMPORARY"],
'oracle_on_commit': 'PRESERVE ROWS'
}
else:
@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'])
@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'])
@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')
@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],
@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
@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)