We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71fd12e commit 40e09e0Copy full SHA for 40e09e0
pandas/io/tests/test_sql.py
@@ -2237,6 +2237,7 @@ def setUp(self):
2237
except:
2238
pass
2239
else:
2240
+ self.addCleanup(self._try_close_db)
2241
return
2242
try:
2243
self.db = pymysql.connect(read_default_group='pandas')
@@ -2251,6 +2252,15 @@ def setUp(self):
2251
2252
"Create a group of connection parameters under the heading "
2253
"[pandas] in your system's mysql default file, "
2254
"typically located at ~/.my.cnf or /etc/.my.cnf. ")
2255
+ else:
2256
2257
+
2258
+ def _try_close_db(self):
2259
+ from pymysql.err import Error
2260
+ try:
2261
+ self.db.close()
2262
+ except Error:
2263
+ pass
2264
2265
def test_basic(self):
2266
_skip_if_no_pymysql()
0 commit comments