@@ -41,8 +41,9 @@ def shutdown():
41
41
c .execute ("drop table dictcursor" )
42
42
super (TestDictCursor , self ).tearDown ()
43
43
44
+ @gen .coroutine
44
45
def _ensure_cursor_expired (self , cursor ):
45
- pass
46
+ raise gen . Return ()
46
47
47
48
@gen_test
48
49
def test_DictCursor (self ):
@@ -58,7 +59,7 @@ def test_DictCursor(self):
58
59
yield c .execute ("SELECT * from dictcursor where name='bob'" )
59
60
r = c .fetchone ()
60
61
self .assertEqual (bob , r , "fetchone via DictCursor failed" )
61
- self ._ensure_cursor_expired (c )
62
+ yield self ._ensure_cursor_expired (c )
62
63
63
64
# same again, but via fetchall => tuple)
64
65
yield c .execute ("SELECT * from dictcursor where name='bob'" )
@@ -80,7 +81,7 @@ def test_DictCursor(self):
80
81
yield c .execute ("SELECT * from dictcursor" )
81
82
r = c .fetchmany (2 )
82
83
self .assertEqual ([bob , jim ], r , "fetchmany failed via DictCursor" )
83
- self ._ensure_cursor_expired (c )
84
+ yield self ._ensure_cursor_expired (c )
84
85
85
86
@gen_test
86
87
def test_custom_dict (self ):
@@ -98,7 +99,7 @@ class MyDictCursor(self.cursor_type):
98
99
yield cur .execute ("SELECT * FROM dictcursor WHERE name='bob'" )
99
100
r = cur .fetchone ()
100
101
self .assertEqual (bob , r , "fetchone() returns MyDictCursor" )
101
- self ._ensure_cursor_expired (cur )
102
+ yield self ._ensure_cursor_expired (cur )
102
103
103
104
yield cur .execute ("SELECT * FROM dictcursor" )
104
105
r = cur .fetchall ()
@@ -114,14 +115,15 @@ class MyDictCursor(self.cursor_type):
114
115
r = cur .fetchmany (2 )
115
116
self .assertEqual ([bob , jim ], r ,
116
117
"list failed via MyDictCursor" )
117
- self ._ensure_cursor_expired (cur )
118
+ yield self ._ensure_cursor_expired (cur )
118
119
119
120
120
- # class TestSSDictCursor(TestDictCursor):
121
- # cursor_type = tornado_mysql.cursors.SSDictCursor
121
+ class TestSSDictCursor (TestDictCursor ):
122
+ cursor_type = tornado_mysql .cursors .SSDictCursor
122
123
124
+ @gen .coroutine
123
125
def _ensure_cursor_expired (self , cursor ):
124
- list ( cursor .fetchall_unbuffered () )
126
+ yield cursor .fetchall ( )
125
127
126
128
if __name__ == "__main__" :
127
129
import unittest
0 commit comments