Skip to content

Commit 81f180c

Browse files
committed
Add __iter__ to MockCursor
1 parent ad6ab5b commit 81f180c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,13 +1310,17 @@ def __init__(self) -> None:
13101310
self._cnx._cmysql.get_client_info = mock.MagicMock(
13111311
return_value="1.2.3"
13121312
)
1313+
self._items = []
13131314

13141315
# pylint: disable=unused-argument, no-self-use
13151316
def execute(self, query, params=None, throw_exception=False):
13161317
if throw_exception:
13171318
# pylint: disable=broad-exception-raised
13181319
raise Exception("Test Exception")
13191320

1321+
def __iter__(self):
1322+
yield from self._items
1323+
13201324
# pylint: disable=unused-argument, no-self-use
13211325
def executemany(self, query, params=None, throw_exception=False):
13221326
if throw_exception:

0 commit comments

Comments
 (0)