(self, session)
| 763 | ) |
| 764 | |
| 765 | def _flag_fixture(self, session): |
| 766 | canary = Mock() |
| 767 | |
| 768 | @event.listens_for(session, "do_orm_execute") |
| 769 | def do_orm_execute(ctx): |
| 770 | if not ctx.is_select: |
| 771 | assert_raises_message( |
| 772 | sa.exc.InvalidRequestError, |
| 773 | "This ORM execution is not against a SELECT statement", |
| 774 | lambda: ctx.lazy_loaded_from, |
| 775 | ) |
| 776 | |
| 777 | canary.options( |
| 778 | bind_mapper=ctx.bind_mapper, |
| 779 | all_mappers=ctx.all_mappers, |
| 780 | is_select=ctx.is_select, |
| 781 | is_from_statement=ctx.is_from_statement, |
| 782 | is_insert=ctx.is_insert, |
| 783 | is_update=ctx.is_update, |
| 784 | is_delete=ctx.is_delete, |
| 785 | is_orm_statement=ctx.is_orm_statement, |
| 786 | is_relationship_load=ctx.is_relationship_load, |
| 787 | is_column_load=ctx.is_column_load, |
| 788 | lazy_loaded_from=( |
| 789 | ctx.lazy_loaded_from if ctx.is_select else None |
| 790 | ), |
| 791 | ) |
| 792 | |
| 793 | return canary |
| 794 | |
| 795 | @testing.combinations( |
| 796 | (lambda: select(1), True), |
no outgoing calls
no test coverage detected