Skip to content

Commit abcb5f9

Browse files
committed
Add test to reproduce PyMySQL#399
1 parent 78af0a9 commit abcb5f9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pymysql/tests/test_connection.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def test_connection_gone_away(self):
418418
with self.assertRaises(pymysql.OperationalError) as cm:
419419
cur.execute("SELECT 1+1")
420420
# error occures while reading, not writing because of socket buffer.
421-
#self.assertEquals(cm.exception.args[0], 2006)
421+
#self.assertEqual(cm.exception.args[0], 2006)
422422
self.assertIn(cm.exception.args[0], (2006, 2013))
423423

424424
def test_init_command(self):
@@ -566,3 +566,11 @@ def test_previous_cursor_not_closed(self):
566566
cur2 = con.cursor()
567567
with self.assertRaises(pymysql.ProgrammingError):
568568
cur2.execute("SELECT 3")
569+
570+
def test_commit_during_multi_result(self):
571+
con = self.connections[0]
572+
cur = con.cursor()
573+
cur.execute("SELECT 1; SELECT 2")
574+
con.commit()
575+
cur.execute("SELECT 3")
576+
self.assertEqual(cur.fetchone()[0], 3)

0 commit comments

Comments
 (0)