Skip to content

Commit 07f63c0

Browse files
committed
Fix docker tests
1 parent 2d7b129 commit 07f63c0

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

Diff for: tests/opentelemetry-docker-tests/tests/mysql/test_mysql_functional.py

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def setUp(self):
4343
self._cursor = self._connection.cursor()
4444

4545
def tearDown(self):
46+
self._cursor.close()
4647
self._connection.close()
4748
MySQLInstrumentor().uninstrument()
4849
super().tearDown()

Diff for: tests/opentelemetry-docker-tests/tests/postgres/test_aiopg_functional.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def async_call(coro):
3737

3838
class TestFunctionalAiopgConnect(TestBase):
3939
def setUp(self):
40+
super().setUp()
4041
self._tracer = self.tracer_provider.get_tracer(__name__)
4142
AiopgInstrumentor().instrument(tracer_provider=self.tracer_provider)
4243
self._connection = async_call(

Diff for: tests/opentelemetry-docker-tests/tests/postgres/test_psycopg_functional.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
class TestFunctionalPsycopg(TestBase):
33-
def setU(self):
33+
def setUp(self):
3434
super().setUp()
3535
self._tracer = self.tracer_provider.get_tracer(__name__)
3636
Psycopg2Instrumentor().instrument(tracer_provider=self.tracer_provider)
@@ -45,10 +45,8 @@ def setU(self):
4545
self._cursor = self._connection.cursor()
4646

4747
def tearDown(self):
48-
if self._cursor:
49-
self._cursor.close()
50-
if self._connection:
51-
self._connection.close()
48+
self._cursor.close()
49+
self._connection.close()
5250
Psycopg2Instrumentor().uninstrument()
5351
super().tearDown()
5452

Diff for: tests/opentelemetry-docker-tests/tests/postgres/test_psycopg_sqlcommenter.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def setUp(self):
4040
self._connection.set_session(autocommit=True)
4141
self._cursor = self._connection.cursor()
4242

43-
@classmethod
4443
def tearDown(self):
4544
self._cursor.close()
4645
self._connection.close()

Diff for: tests/opentelemetry-docker-tests/tests/pymysql/test_pymysql_functional.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
class TestFunctionalPyMysql(TestBase):
3232
def setUp(self):
3333
super().setUp()
34-
self._connection = None
35-
self._cursor = None
3634
self._tracer = self.tracer_provider.get_tracer(__name__)
3735
PyMySQLInstrumentor().instrument()
3836
self._connection = pymy.connect(
@@ -45,8 +43,8 @@ def setUp(self):
4543
self._cursor = self._connection.cursor()
4644

4745
def tearDown(self):
48-
if self._connection:
49-
self._connection.close()
46+
self._cursor.close()
47+
self._connection.close()
5048
PyMySQLInstrumentor().uninstrument()
5149
super().tearDown()
5250

0 commit comments

Comments
 (0)