MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _proxy_fixture

Method _proxy_fixture

test/sql/test_resultset.py:3143–3168  ·  view source on GitHub ↗
(self, cls)

Source from the content-addressed store, hash-verified

3141
3142 @contextmanager
3143 def _proxy_fixture(self, cls):
3144 self.table = self.tables.test
3145
3146 class ExcCtx(default.DefaultExecutionContext):
3147 def post_exec(self):
3148 if cls is _cursor.CursorFetchStrategy:
3149 pass
3150 elif cls is _cursor.BufferedRowCursorFetchStrategy:
3151 self.cursor_fetch_strategy = cls(
3152 self.cursor, self.execution_options
3153 )
3154 elif cls is _cursor.FullyBufferedCursorFetchStrategy:
3155 self.cursor_fetch_strategy = cls(
3156 self.cursor,
3157 self.cursor.description,
3158 self.cursor.fetchall(),
3159 )
3160 else:
3161 assert False
3162
3163 self.patcher = patch.object(
3164 self.engine.dialect, "execution_ctx_cls", ExcCtx
3165 )
3166
3167 with self.patcher:
3168 yield
3169
3170 def _test_proxy(self, cls):
3171 with self._proxy_fixture(cls):

Calls 1

objectMethod · 0.80

Tested by

no test coverage detected