autocommit is not set after reconnecting with ping()
(self)
| 348 | cur.execute("DROP PROCEDURE IF EXISTS `foo`") |
| 349 | |
| 350 | def test_issue_114(self): |
| 351 | """autocommit is not set after reconnecting with ping()""" |
| 352 | conn = pymysql.connect(charset="utf8", **self.databases[0]) |
| 353 | conn.autocommit(False) |
| 354 | c = conn.cursor() |
| 355 | c.execute("""select @@autocommit;""") |
| 356 | self.assertFalse(c.fetchone()[0]) |
| 357 | conn.close() |
| 358 | with warnings.catch_warnings(): |
| 359 | warnings.filterwarnings("ignore") |
| 360 | conn.ping(reconnect=True) |
| 361 | c.execute("""select @@autocommit;""") |
| 362 | self.assertFalse(c.fetchone()[0]) |
| 363 | conn.close() |
| 364 | |
| 365 | # Ensure autocommit() is still working |
| 366 | conn = pymysql.connect(charset="utf8", **self.databases[0]) |
| 367 | c = conn.cursor() |
| 368 | c.execute("""select @@autocommit;""") |
| 369 | self.assertFalse(c.fetchone()[0]) |
| 370 | conn.close() |
| 371 | with warnings.catch_warnings(): |
| 372 | warnings.filterwarnings("ignore") |
| 373 | conn.ping(reconnect=True) |
| 374 | conn.autocommit(True) |
| 375 | c.execute("""select @@autocommit;""") |
| 376 | self.assertTrue(c.fetchone()[0]) |
| 377 | conn.close() |
| 378 | |
| 379 | def test_issue_175(self): |
| 380 | """The number of fields returned by server is read in wrong way""" |