Skip to content

Commit 4e49915

Browse files
ext/docker-tests: Fix SQL docker tests
The executemany test fails in some conditions because the argument used is a sequence and not a sequence of sequences as it should be: https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-executemany.html https://pymysql.readthedocs.io/en/latest/modules/cursors.html#pymysql.cursors.Cursor.executemany https://www.psycopg.org/docs/cursor.html#cursor.executemany
1 parent 090b664 commit 4e49915

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ext/opentelemetry-ext-docker-tests/tests/mysql/test_mysql_functional.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_executemany(self):
8282
"""Should create a child span for executemany
8383
"""
8484
with self._tracer.start_as_current_span("rootSpan"):
85-
data = ["1", "2", "3"]
85+
data = (("1",), ("2",), ("3",))
8686
stmt = "INSERT INTO test (id) VALUES (%s)"
8787
self._cursor.executemany(stmt, data)
8888
self.validate_spans()

ext/opentelemetry-ext-docker-tests/tests/postgres/test_psycopg_functional.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_executemany(self):
8989
"""Should create a child span for executemany
9090
"""
9191
with self._tracer.start_as_current_span("rootSpan"):
92-
data = ("1", "2", "3")
92+
data = (("1",), ("2",), ("3",))
9393
stmt = "INSERT INTO test (id) VALUES (%s)"
9494
self._cursor.executemany(stmt, data)
9595
self.validate_spans()

ext/opentelemetry-ext-docker-tests/tests/pymysql/test_pymysql_functional.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_executemany(self):
8181
"""Should create a child span for executemany
8282
"""
8383
with self._tracer.start_as_current_span("rootSpan"):
84-
data = ["1", "2", "3"]
84+
data = (("1",), ("2",), ("3",))
8585
stmt = "INSERT INTO test (id) VALUES (%s)"
8686
self._cursor.executemany(stmt, data)
8787
self.validate_spans()

0 commit comments

Comments
 (0)