10000 Better organize `TestGitHubIssues`. · gcmcom/PyMySQL@aaba4df · GitHub
[go: up one dir, main page]

Skip to content

Commit aaba4df

Browse files
committed
Better organize TestGitHubIssues.
1 parent ef2385e commit aaba4df

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

pymysql/tests/test_issues.py

+28-26
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def disabled_test_issue_54(self):
250250

251251
class TestGitHubIssues(base.PyMySQLTestCase):
252252
def test_issue_66(self):
253+
""" 'Connection' object has no attribute 'insert_id' """
253254
conn = self.connections[0]
254255
c = conn.cursor()
255256
self.assertEqual(0, conn.insert_id())
@@ -262,32 +263,8 @@ def test_issue_66(self):
262263
finally:
263264
c.execute("drop table issue66")
264265

265-
def test_issue_114(self):
266-
conn = pymysql.connect(charset="utf8", **self.databases[0])
267-
conn.autocommit(False)
268-
c = conn.cursor()
269-
c.execute("""select @@autocommit;""")
270-
self.assertFalse(c.fetchone()[0])
271-
conn.close()
272-
conn.ping()
273-
c.execute("""select @@autocommit;""")
274-
self.assertFalse(c.fetchone()[0])
275-
conn.close()
276-
277-
# Ensure autocommit() is still working
278-
conn = pymysql.connect(charset="utf8", **self.databases[0])
279-
c = conn.cursor()
280-
c.execute("""select @@autocommit;""")
281-
self.assertFalse(c.fetchone()[0])
282-
conn.close()
283-
conn.ping()
284-
conn.autocommit(True)
285-
c.execute("""select @@autocommit;""")
286-
self.assertTrue(c.fetchone()[0])
287-
conn.close()
288-
289-
def test_Duplicate_field(self):
290-
'''#79'''
266+
def test_issue_79(self):
267+
""" Duplicate field overwrites the previous one in the result of DictCursor """
291268
conn = self.connections[0]
292269
c = conn.cursor(pymysql.cursors.DictCursor)
293270

@@ -312,6 +289,7 @@ def test_Duplicate_field(self):
312289
c.execute("drop table b")
313290

314291
def test_issue_95(self):
292+
""" Leftover trailing OK packet for "CALL my_sp" queries """
315293
conn = self.connections[0]
316294
cur = conn.cursor()
317295
cur.execute("DROP PROCEDURE IF EXISTS `foo`")
@@ -326,6 +304,30 @@ def test_issue_95(self):
326304
finally:
327305
cur.execute("DROP PROCEDURE IF EXISTS `foo`")
328306

307+
def test_issue_114(self):
308+
""" autocommit is not set after reconnecting with ping() """
309+
conn = pymysql.connect(charset="utf8", **self.databases[0])
310+
conn.autocommit(False)
311+
c = conn.cursor()
312+
c.execute("""select @@autocommit;""")
313+
self.assertFalse(c.fetchone()[0])
314+
conn.close()
315+
conn.ping()
316+
c.execute("""select @@autocommit;""")
317+
self.assertFalse(c.fetchone()[0])
318+
conn.close()
319+
320+
# Ensure autocommit() is still working
321+
conn = pymysql.connect(charset="utf8", **self.databases[0])
322+
c = conn.cursor()
323+
c.execute("""select @@autocommit;""")
324+
self.assertFalse(c.fetchone()[0])
325+
conn.close()
326+
conn.ping()
327+
conn.autocommit(True)
328+
c.execute("""select @@autocommit;""")
329+
self.assertTrue(c.fetchone()[0])
330+
conn.close()
329331

330332

331333
__all__ = ["TestOldIssues", "TestNewIssues", "TestGitHubIssues"]

0 commit comments

Comments
 (0)
0