diff options
Diffstat (limited to 'test/lib/engines.py')
-rw-r--r-- | test/lib/engines.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/lib/engines.py b/test/lib/engines.py index 60272839b..1c97e23cf 100644 --- a/test/lib/engines.py +++ b/test/lib/engines.py @@ -65,11 +65,11 @@ def rollback_open_connections(fn, *args, **kw): @decorator def close_first(fn, *args, **kw): """Decorator that closes all connections before fn execution.""" - + testing_reaper.close_all() fn(*args, **kw) - - + + @decorator def close_open_connections(fn, *args, **kw): """Decorator that closes all connections after fn execution.""" @@ -88,7 +88,7 @@ def all_dialects(exclude=None): if not mod: mod = getattr(__import__('sqlalchemy.databases.%s' % name).databases, name) yield mod.dialect() - + class ReconnectFixture(object): def __init__(self, dbapi): self.dbapi = dbapi @@ -135,11 +135,11 @@ def testing_engine(url=None, options=None): event.listen(engine, 'after_execute', asserter.execute) event.listen(engine, 'after_cursor_execute', asserter.cursor_execute) event.listen(engine.pool, 'checkout', testing_reaper.checkout) - + # may want to call this, results # in first-connect initializers #engine.connect() - + return engine def utf8_engine(url=None, options=None): @@ -165,18 +165,18 @@ def utf8_engine(url=None, options=None): def mock_engine(dialect_name=None): """Provides a mocking engine based on the current testing.db. - + This is normally used to test DDL generation flow as emitted by an Engine. - + It should not be used in other cases, as assert_compile() and assert_sql_execution() are much better choices with fewer moving parts. - + """ - + from sqlalchemy import create_engine - + if not dialect_name: dialect_name = config.db.name @@ -186,7 +186,7 @@ def mock_engine(dialect_name=None): def assert_sql(stmts): recv = [re.sub(r'[\n\t]', '', str(s)) for s in buffer] assert recv == stmts, recv - + engine = create_engine(dialect_name + '://', strategy='mock', executor=executor) assert not hasattr(engine, 'mock') @@ -212,7 +212,7 @@ class ReplayableSession(object): #for t in ('FunctionType', 'BuiltinFunctionType', # 'MethodType', 'BuiltinMethodType', # 'LambdaType', )]) - + # Py2K for t in ('FunctionType', 'BuiltinFunctionType', 'MethodType', 'BuiltinMethodType', @@ -243,11 +243,11 @@ class ReplayableSession(object): else: buffer.append(result) return result - + @property def _sqla_unwrap(self): return self._subject - + def __getattribute__(self, key): try: return object.__getattribute__(self, key) @@ -280,11 +280,11 @@ class ReplayableSession(object): return self else: return result - + @property def _sqla_unwrap(self): return None - + def __getattribute__(self, key): try: return object.__getattribute__(self, key) |