Skip to content
Snippets Groups Projects
Commit c690ed64953e authored by INADA Naoki's avatar INADA Naoki
Browse files

Fix some tests

parent c05b5d48c177
Branches
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@
@gen.coroutine
def shutdown():
c = self.conn.cursor()
c.execute("drop table dictcursor")
yield c.execute("drop table dictcursor")
super(TestDictCursor, self).tearDown()
@gen.coroutine
......
......@@ -31,6 +31,8 @@
cursor = conn.cursor(tornado_mysql.cursors.SSCursor)
# Create table
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield cursor.execute('DROP TABLE IF EXISTS tz_data;')
yield cursor.execute(('CREATE TABLE tz_data ('
'region VARCHAR(64),'
......@@ -112,6 +114,8 @@
def _prepare(self):
conn = self.connections[0]
cursor = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield cursor.execute('DROP TABLE IF EXISTS tz_data;')
yield cursor.execute('CREATE TABLE tz_data ('
'region VARCHAR(64),'
......
......@@ -23,6 +23,8 @@
""" undefined methods datetime_or_None, date_or_None """
conn = self.connections[0]
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue3")
yield c.execute("create table issue3 (d date, t time, dt datetime, ts timestamp)")
try:
......@@ -43,6 +45,8 @@
""" can't retrieve TIMESTAMP fields """
conn = self.connections[0]
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue4")
yield c.execute("create table issue4 (ts timestamp)")
try:
......@@ -75,6 +79,8 @@
""" Primary Key and Index error when selecting data """
conn = self.connections[0]
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists test")
yield c.execute("""CREATE TABLE `test` (`station` int(10) NOT NULL DEFAULT '0', `dh`
datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `echeance` int(1) NOT NULL
......@@ -102,4 +108,6 @@
""" can't handle large result fields """
conn = self.connections[0]
cur = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield cur.execute("drop table if exists issue13")
......@@ -105,2 +113,3 @@
yield cur.execute("drop table if exists issue13")
yield cur.execute("create table issue13 (t text)")
try:
......@@ -106,5 +115,4 @@
try:
yield cur.execute("create table issue13 (t text)")
# ticket says 18k
size = 18*1024
yield cur.execute("insert into issue13 (t) values (%s)", ("x" * size,))
......@@ -120,6 +128,8 @@
""" query should be expanded before perform character encoding """
conn = self.connections[0]
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue15")
yield c.execute("create table issue15 (t varchar(32))")
try:
......@@ -134,6 +144,8 @@
""" Patch for string and tuple escaping """
conn = self.connections[0]
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue16")
yield c.execute("create table issue16 (name varchar(32) primary key, email varchar(32))")
try:
......@@ -151,6 +163,7 @@
db = self.databases[0]["db"]
c = conn.cursor()
# grant access to a table to a user with a password
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue17")
yield c.execute("create table issue17 (x varchar(32) primary key)")
......@@ -155,5 +168,6 @@
yield c.execute("drop table if exists issue17")
yield c.execute("create table issue17 (x varchar(32) primary key)")
try:
yield c.execute("insert into issue17 (x) values ('hello, world!')")
yield c.execute("grant all privileges on %s.issue17 to 'issue17user'@'%%' identified by '1234'" % db)
yield conn.commit()
......@@ -180,4 +194,7 @@
def test_issue_33(self):
conn = yield tornado_mysql.connect(charset="utf8", **self.databases[0])
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute(b"drop table if exists hei\xc3\x9fe".decode("utf8"))
try:
......@@ -183,5 +200,4 @@
try:
yield c.execute(b"drop table if exists hei\xc3\x9fe".decode("utf8"))
yield c.execute(b"create table hei\xc3\x9fe (name varchar(32))".decode("utf8"))
yield c.execute(b"insert into hei\xc3\x9fe (name) values ('Pi\xc3\xb1ata')".decode("utf8"))
yield c.execute(b"select name from hei\xc3\x9fe".decode("utf8"))
......@@ -246,4 +262,7 @@
c = conn.cursor()
datum = "a" * 1024 * 1023 # reduced size for most default mysql installs
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue38")
try:
......@@ -249,5 +268,4 @@
try:
yield c.execute("drop table if exists issue38")
yield c.execute("create table issue38 (id integer, data mediumblob)")
yield c.execute("insert into issue38 values (1, %s)", (datum,))
finally:
......@@ -257,6 +275,8 @@
def disabled_test_issue_54(self):
conn = self.connections[0]
c = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield c.execute("drop table if exists issue54")
big_sql = "select * from issue54 where "
big_sql += " and ".join("%d=%d" % (i,i) for i in range(0, 100000))
......@@ -320,6 +340,8 @@
""" Leftover trailing OK packet for "CALL my_sp" queries """
conn = self.connections[0]
cur = conn.cursor()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield cur.execute("DROP PROCEDURE IF EXISTS `foo`")
yield cur.execute("""CREATE PROCEDURE `foo` ()
BEGIN
......@@ -371,7 +393,7 @@
yield cur.execute('select * from test_field_count')
assert len(cur.description) == length
finally:
yield cur.execute('drop table if exists test_field_count')
yield cur.execute('drop table test_field_count')
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment