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