@@ -41,8 +41,9 @@ def shutdown():
4141 c .execute ("drop table dictcursor" )
4242 super (TestDictCursor , self ).tearDown ()
4343
44+ @gen .coroutine
4445 def _ensure_cursor_expired (self , cursor ):
45- pass
46+ raise gen . Return ()
4647
4748 @gen_test
4849 def test_DictCursor (self ):
@@ -58,7 +59,7 @@ def test_DictCursor(self):
5859 yield c .execute ("SELECT * from dictcursor where name='bob'" )
5960 r = c .fetchone ()
6061 self .assertEqual (bob , r , "fetchone via DictCursor failed" )
61- self ._ensure_cursor_expired (c )
62+ yield self ._ensure_cursor_expired (c )
6263
6364 # same again, but via fetchall => tuple)
6465 yield c .execute ("SELECT * from dictcursor where name='bob'" )
@@ -80,7 +81,7 @@ def test_DictCursor(self):
8081 yield c .execute ("SELECT * from dictcursor" )
8182 r = c .fetchmany (2 )
8283 self .assertEqual ([bob , jim ], r , "fetchmany failed via DictCursor" )
83- self ._ensure_cursor_expired (c )
84+ yield self ._ensure_cursor_expired (c )
8485
8586 @gen_test
8687 def test_custom_dict (self ):
@@ -98,7 +99,7 @@ class MyDictCursor(self.cursor_type):
9899 yield cur .execute ("SELECT * FROM dictcursor WHERE name='bob'" )
99100 r = cur .fetchone ()
100101 self .assertEqual (bob , r , "fetchone() returns MyDictCursor" )
101- self ._ensure_cursor_expired (cur )
102+ yield self ._ensure_cursor_expired (cur )
102103
103104 yield cur .execute ("SELECT * FROM dictcursor" )
104105 r = cur .fetchall ()
@@ -114,14 +115,15 @@ class MyDictCursor(self.cursor_type):
114115 r = cur .fetchmany (2 )
115116 self .assertEqual ([bob , jim ], r ,
116117 "list failed via MyDictCursor" )
117- self ._ensure_cursor_expired (cur )
118+ yield self ._ensure_cursor_expired (cur )
118119
119120
120- # class TestSSDictCursor(TestDictCursor):
121- # cursor_type = tornado_mysql.cursors.SSDictCursor
121+ class TestSSDictCursor (TestDictCursor ):
122+ cursor_type = tornado_mysql .cursors .SSDictCursor
122123
124+ @gen .coroutine
123125 def _ensure_cursor_expired (self , cursor ):
124- list ( cursor .fetchall_unbuffered () )
126+ yield cursor .fetchall ( )
125127
126128if __name__ == "__main__" :
127129 import unittest
0 commit comments