(self)
| 383 | |
| 384 | @contextlib.contextmanager |
| 385 | def _fixture(self): |
| 386 | from sqlalchemy import event |
| 387 | |
| 388 | User = self.classes.User |
| 389 | |
| 390 | with testing.db.connect() as conn: |
| 391 | |
| 392 | @event.listens_for(conn, "before_execute") |
| 393 | def before_execute( |
| 394 | conn, clauseelement, multiparams, params, execution_options |
| 395 | ): |
| 396 | # execution options are kind of moving around a bit, |
| 397 | # test both places |
| 398 | assert ( |
| 399 | "yes" in clauseelement._execution_options |
| 400 | or "yes" in execution_options |
| 401 | ) |
| 402 | |
| 403 | bq = self.bakery(lambda s: s.query(User.id).order_by(User.id)) |
| 404 | |
| 405 | sess = Session(conn) |
| 406 | |
| 407 | yield sess, bq |
| 408 | |
| 409 | def test_first(self): |
| 410 | with self._fixture() as (sess, bq): |
no test coverage detected