Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,9 @@ def __enter__(self):
def __exit__(self, *args, **kwargs):
self.__wrapped__.__exit__(*args, **kwargs)

def __iter__(self):
Comment thread
xrmx marked this conversation as resolved.
Outdated
return iter(self.__wrapped__)


def get_traced_cursor_proxy(
cursor: CursorT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,19 @@ def test_executemany(self):
span = spans_list[0]
self.assertEqual(span.attributes[DB_STATEMENT], "Test query")

def test_executemany_iterable_cursor(self):
Comment thread
xrmx marked this conversation as resolved.
db_integration = dbapi.DatabaseApiIntegration(
"instrumenting_module_test_name", "testcomponent"
)
mock_connection = db_integration.wrapped_connection(
mock_connect, {}, {}
)
cursor = mock_connection.cursor()
cursor.executemany("Test query")

for _row in cursor:
Comment thread
xrmx marked this conversation as resolved.
pass

def test_executemany_comment(self):
connect_module = mock.MagicMock()
connect_module.__name__ = "test"
Expand Down