@@ -23,7 +23,9 @@ def test_issue_3(self):
23
23
""" undefined methods datetime_or_None, date_or_None """
24
24
conn = self .connections [0 ]
25
25
c = conn .cursor ()
26
- yield c .execute ("drop table if exists issue3" )
26
+ with warnings .catch_warnings ():
27
+ warnings .simplefilter ("ignore" )
28
+ yield c .execute ("drop table if exists issue3" )
27
29
yield c .execute ("create table issue3 (d date, t time, dt datetime, ts timestamp)" )
28
30
try :
29
31
yield c .execute ("insert into issue3 (d, t, dt, ts) values (%s,%s,%s,%s)" , (None , None , None , None ))
@@ -43,7 +45,9 @@ def test_issue_4(self):
43
45
""" can't retrieve TIMESTAMP fields """
44
46
conn = self .connections [0 ]
45
47
c = conn .cursor ()
46
- yield c .execute ("drop table if exists issue4" )
48
+ with warnings .catch_warnings ():
49
+ warnings .simplefilter ("ignore" )
50
+ yield c .execute ("drop table if exists issue4" )
47
51
yield c .execute ("create table issue4 (ts timestamp)" )
48
52
try :
49
53
yield c .execute ("insert into issue4 (ts) values (now())" )
@@ -75,7 +79,9 @@ def test_issue_8(self):
75
79
""" Primary Key and Index error when selecting data """
76
80
conn = self .connections [0 ]
77
81
c = conn .cursor ()
78
- yield c .execute ("drop table if exists test" )
82
+ with warnings .catch_warnings ():
83
+ warnings .simplefilter ("ignore" )
84
+ yield c .execute ("drop table if exists test" )
79
85
yield c .execute ("""CREATE TABLE `test` (`station` int(10) NOT NULL DEFAULT '0', `dh`
80
86
datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `echeance` int(1) NOT NULL
81
87
DEFAULT '0', `me` double DEFAULT NULL, `mo` double DEFAULT NULL, PRIMARY
@@ -102,9 +108,11 @@ def test_issue_13(self):
102
108
""" can't handle large result fields """
103
109
conn = self .connections [0 ]
104
110
cur = conn .cursor ()
105
- yield cur .execute ("drop table if exists issue13" )
111
+ with warnings .catch_warnings ():
112
+ warnings .simplefilter ("ignore" )
113
+ yield cur .execute ("drop table if exists issue13" )
114
+ yield cur .execute ("create table issue13 (t text)" )
106
115
try :
107
- yield cur .execute ("create table issue13 (t text)" )
108
116
# ticket says 18k
109
117
size = 18 * 1024
110
118
yield cur .execute ("insert into issue13 (t) values (%s)" , ("x" * size ,))
@@ -120,7 +128,9 @@ def test_issue_15(self):
120
128
""" query should be expanded before perform character encoding """
121
129
conn = self .connections [0 ]
122
130
c = conn .cursor ()
123
- yield c .execute ("drop table if exists issue15" )
131
+ with warnings .catch_warnings ():
132
+ warnings .simplefilter ("ignore" )
133
+ yield c .execute ("drop table if exists issue15" )
124
134
yield c .execute ("create table issue15 (t varchar(32))" )
125
135
try :
126
136
yield c .execute ("insert into issue15 (t) values (%s)" , (u'\xe4 \xf6 \xfc ' ,))
@@ -134,7 +144,9 @@ def test_issue_16(self):
134
144
""" Patch for string and tuple escaping """
135
145
conn = self .connections [0 ]
136
146
c = conn .cursor ()
137
- yield c .execute ("drop table if exists issue16" )
147
+ with warnings .catch_warnings ():
148
+ warnings .simplefilter ("ignore" )
149
+ yield c .execute ("drop table if exists issue16" )
138
150
yield c .execute ("create table issue16 (name varchar(32) primary key, email varchar(32))" )
139
151
try :
140
152
yield c .execute ("insert into issue16 (name, email) values ('pete', 'floydophone')" )
@@ -151,9 +163,11 @@ def test_issue_17(self):
151
163
db = self .databases [0 ]["db" ]
152
164
c = conn .cursor ()
153
165
# grant access to a table to a user with a password
154
- try :
166
+ with warnings .catch_warnings ():
167
+ warnings .simplefilter ("ignore" )
155
168
yield c .execute ("drop table if exists issue17" )
156
- yield c .execute ("create table issue17 (x varchar(32) primary key)" )
169
+ yield c .execute ("create table issue17 (x varchar(32) primary key)" )
170
+ try :
157
171
yield c .execute ("insert into issue17 (x) values ('hello, world!')" )
158
172
yield c .execute ("grant all privileges on %s.issue17 to 'issue17user'@'%%' identified by '1234'" % db )
159
173
yield conn .commit ()
@@ -180,8 +194,10 @@ def test_issue_34(self):
180
194
def test_issue_33 (self ):
181
195
conn = yield tornado_mysql .connect (charset = "utf8" , ** self .databases [0 ])
182
196
c = conn .cursor ()
183
- try :
197
+ with warnings .catch_warnings ():
198
+ warnings .simplefilter ("ignore" )
184
199
yield c .execute (b"drop table if exists hei\xc3 \x9f e" .decode ("utf8" ))
200
+ try :
185
201
yield c .execute (b"create table hei\xc3 \x9f e (name varchar(32))" .decode ("utf8" ))
186
202
yield c .execute (b"insert into hei\xc3 \x9f e (name) values ('Pi\xc3 \xb1 ata')" .decode ("utf8" ))
187
203
yield c .execute (b"select name from hei\xc3 \x9f e" .decode ("utf8" ))
@@ -246,8 +262,10 @@ def test_issue_38(self):
246
262
c = conn .cursor ()
247
263
datum = "a" * 1024 * 1023 # reduced size for most default mysql installs
248
264
249
- try :
265
+ with warnings .catch_warnings ():
266
+ warnings .simplefilter ("ignore" )
250
267
yield c .execute ("drop table if exists issue38" )
268
+ try :
251
269
yield c .execute ("create table issue38 (id integer, data mediumblob)" )
252
270
yield c .execute ("insert into issue38 values (1, %s)" , (datum ,))
253
271
finally :
@@ -257,7 +275,9 @@ def test_issue_38(self):
257
275
def disabled_test_issue_54 (self ):
258
276
conn = self .connections [0 ]
259
277
c = conn .cursor ()
260
- yield c .execute ("drop table if exists issue54" )
278
+ with warnings .catch_warnings ():
279
+ warnings .simplefilter ("ignore" )
280
+ yield c .execute ("drop table if exists issue54" )
261
281
big_sql = "select * from issue54 where "
262
282
big_sql += " and " .join ("%d=%d" % (i ,i ) for i in range (0 , 100000 ))
263
283
@@ -320,7 +340,9 @@ def test_issue_95(self):
320
340
""" Leftover trailing OK packet for "CALL my_sp" queries """
321
341
conn = self .connections [0 ]
322
342
cur = conn .cursor ()
323
- yield cur .execute ("DROP PROCEDURE IF EXISTS `foo`" )
343
+ with warnings .catch_warnings ():
344
+ warnings .simplefilter ("ignore" )
345
+ yield cur .execute ("DROP PROCEDURE IF EXISTS `foo`" )
324
346
yield cur .execute ("""CREATE PROCEDURE `foo` ()
325
347
BEGIN
326
348
SELECT 1;
@@ -371,7 +393,7 @@ def test_issue_175(self):
371
393
yield cur .execute ('select * from test_field_count' )
372
394
assert len (cur .description ) == length
373
395
finally :
374
- yield cur .execute ('drop table if exists test_field_count' )
396
+ yield cur .execute ('drop table test_field_count' )
375
397
376
398
377
399
if __name__ == "__main__" :
0 commit comments