(self, session)
| 712 | ) |
| 713 | |
| 714 | def _flag_fixture(self, session): |
| 715 | canary = Mock() |
| 716 | |
| 717 | @event.listens_for(session, "do_orm_execute") |
| 718 | def do_orm_execute(ctx): |
| 719 | if not ctx.is_select: |
| 720 | assert_raises_message( |
| 721 | sa.exc.InvalidRequestError, |
| 722 | "This ORM execution is not against a SELECT statement", |
| 723 | lambda: ctx.lazy_loaded_from, |
| 724 | ) |
| 725 | |
| 726 | canary.options( |
| 727 | bind_mapper=ctx.bind_mapper, |
| 728 | all_mappers=ctx.all_mappers, |
| 729 | is_select=ctx.is_select, |
| 730 | is_from_statement=ctx.is_from_statement, |
| 731 | is_insert=ctx.is_insert, |
| 732 | is_update=ctx.is_update, |
| 733 | is_delete=ctx.is_delete, |
| 734 | is_orm_statement=ctx.is_orm_statement, |
| 735 | is_relationship_load=ctx.is_relationship_load, |
| 736 | is_column_load=ctx.is_column_load, |
| 737 | lazy_loaded_from=( |
| 738 | ctx.lazy_loaded_from if ctx.is_select else None |
| 739 | ), |
| 740 | ) |
| 741 | |
| 742 | return canary |
| 743 | |
| 744 | @testing.combinations( |
| 745 | (lambda: select(1), True), |
no outgoing calls
no test coverage detected