(self, engine)
| 1755 | |
| 1756 | @contextmanager |
| 1757 | def cursor_wrapper(self, engine): |
| 1758 | calls = defaultdict(int) |
| 1759 | |
| 1760 | class CursorWrapper: |
| 1761 | def __init__(self, real_cursor): |
| 1762 | self.real_cursor = real_cursor |
| 1763 | |
| 1764 | def __getattr__(self, name): |
| 1765 | calls[name] += 1 |
| 1766 | return getattr(self.real_cursor, name) |
| 1767 | |
| 1768 | create_cursor = engine.dialect.execution_ctx_cls.create_cursor |
| 1769 | |
| 1770 | def new_create(context): |
| 1771 | cursor = create_cursor(context) |
| 1772 | return CursorWrapper(cursor) |
| 1773 | |
| 1774 | with patch.object( |
| 1775 | engine.dialect.execution_ctx_cls, "create_cursor", new_create |
| 1776 | ): |
| 1777 | yield calls |
| 1778 | |
| 1779 | def test_no_rowcount_on_selects_inserts(self, metadata, testing_engine): |
| 1780 | """assert that rowcount is only called on deletes and updates. |
no test coverage detected