Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PyMySQL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
PyMySQL
Commits
c690ed64953e
Commit
c690ed64953e
authored
10 years ago
by
INADA Naoki
Browse files
Options
Downloads
Patches
Plain Diff
Fix some tests
parent
c05b5d48c177
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tornado_mysql/tests/test_DictCursor.py
+1
-1
1 addition, 1 deletion
tornado_mysql/tests/test_DictCursor.py
tornado_mysql/tests/test_SSCursor.py
+6
-2
6 additions, 2 deletions
tornado_mysql/tests/test_SSCursor.py
tornado_mysql/tests/test_issues.py
+36
-14
36 additions, 14 deletions
tornado_mysql/tests/test_issues.py
with
43 additions
and
17 deletions
tornado_mysql/tests/test_DictCursor.py
+
1
−
1
View file @
c690ed64
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
tornado_mysql/tests/test_SSCursor.py
+
6
−
2
View file @
c690ed64
...
...
@@ -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),
'
...
...
This diff is collapsed.
Click to expand it.
tornado_mysql/tests/test_issues.py
+
36
−
14
View file @
c690ed64
...
...
@@ -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\x9f
e
"
.
decode
(
"
utf8
"
))
try
:
...
...
@@ -183,5 +200,4 @@
try
:
yield
c
.
execute
(
b
"
drop table if exists hei
\xc3\x9f
e
"
.
decode
(
"
utf8
"
))
yield
c
.
execute
(
b
"
create table hei
\xc3\x9f
e (name varchar(32))
"
.
decode
(
"
utf8
"
))
yield
c
.
execute
(
b
"
insert into hei
\xc3\x9f
e (name) values (
'
Pi
\xc3\xb1
ata
'
)
"
.
decode
(
"
utf8
"
))
yield
c
.
execute
(
b
"
select name from hei
\xc3\x9f
e
"
.
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__
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment