diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/tests/test_sqlite3.py b/instrumentation/opentelemetry-instrumentation-sqlite3/tests/test_sqlite3.py index 581920232b..66235495eb 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlite3/tests/test_sqlite3.py +++ b/instrumentation/opentelemetry-instrumentation-sqlite3/tests/test_sqlite3.py @@ -20,6 +20,21 @@ from opentelemetry.test.test_base import TestBase +class Data: + def __init__(self): + self._connection = sqlite3.connect(":memory:") + self._cursor = self._connection.cursor() + + def __del__(self): + self._cursor.close() + self._connection.close() + + def create_tables(self): + stmt = "CREATE TABLE IF NOT EXISTS test (id integer)" + self._cursor.execute(stmt) + self._connection.commit() + + class TestSQLite3(TestBase): def setUp(self): super().setUp() @@ -100,3 +115,7 @@ def test_callproc(self): ): self._cursor.callproc("test", ()) self.validate_spans("test") + + def test_baseinit(self): + data = Data() + data.create_tables()