Skip to content

Commit

Permalink
Added missing testsuite imports (#467)
Browse files Browse the repository at this point in the history
* Added missing testsuite imports

* Fix broken test

* Remove broken test

* Fix PY3 error

* fix
  • Loading branch information
methane committed May 26, 2016
1 parent ef55b02 commit 5f9c6b3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 54 deletions.
12 changes: 7 additions & 5 deletions pymysql/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from pymysql.tests.test_issues import *
from pymysql.tests.test_basic import *
from pymysql.tests.test_nextset import *
# Sorted by alphabetical order
from pymysql.tests.test_DictCursor import *
from pymysql.tests.test_connection import *
from pymysql.tests.test_SSCursor import *
from pymysql.tests.test_basic import *
from pymysql.tests.test_connection import *
from pymysql.tests.test_converters import *
from pymysql.tests.test_cursor import *
from pymysql.tests.test_issues import *
from pymysql.tests.test_load_local import *
from pymysql.tests.test_nextset import *
from pymysql.tests.test_optionfile import *
from pymysql.tests.test_converters import *

from pymysql.tests.thirdparty import *

Expand Down
24 changes: 7 additions & 17 deletions pymysql/tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,8 @@ def test_cleanup_rows_unbuffered(self):

c2 = conn.cursor()

with warnings.catch_warnings(record=True) as log:
warnings.filterwarnings("always")

c2.execute("select 1")

self.assertGreater(len(log), 0)
self.assertEqual(
"Previous unbuffered result was left incomplete",
str(log[-1].message))
self.assertEqual(
c2.fetchone(), (1,)
)
c2.execute("select 1")
self.assertEqual(c2.fetchone(), (1,))
self.assertIsNone(c2.fetchone())

def test_cleanup_rows_buffered(self):
Expand Down Expand Up @@ -91,14 +81,14 @@ def test_executemany(self):

# cursor._executed must bee "insert into test (data) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)"
# list args
data = xrange(10)
data = range(10)
cursor.executemany("insert into test (data) values (%s)", data)
self.assertTrue(cursor._executed.endswith(",(7),(8),(9)"), 'execute many with %s not in one query')
self.assertTrue(cursor._executed.endswith(b",(7),(8),(9)"), 'execute many with %s not in one query')

# dict args
data_dict = [{'data': i} for i in xrange(10)]
data_dict = [{'data': i} for i in range(10)]
cursor.executemany("insert into test (data) values (%(data)s)", data_dict)
self.assertTrue(cursor._executed.endswith(",(7),(8),(9)"), 'execute many with %(data)s not in one query')
self.assertTrue(cursor._executed.endswith(b",(7),(8),(9)"), 'execute many with %(data)s not in one query')

# %% in column set
cursor.execute("""\
Expand All @@ -109,6 +99,6 @@ def test_executemany(self):
q = "INSERT INTO percent_test (`A%%`, `B%%`) VALUES (%s, %s)"
self.assertIsNotNone(pymysql.cursors.RE_INSERT_VALUES.match(q))
cursor.executemany(q, [(3, 4), (5, 6)])
self.assertTrue(cursor._executed.endswith("(3, 4),(5, 6)"), "executemany with %% not in one query")
self.assertTrue(cursor._executed.endswith(b"(3, 4),(5, 6)"), "executemany with %% not in one query")
finally:
cursor.execute("DROP TABLE IF EXISTS percent_test")
32 changes: 0 additions & 32 deletions pymysql/tests/test_example.py

This file was deleted.

0 comments on commit 5f9c6b3

Please sign in to comment.