Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
2e5038e2
Commit
2e5038e2
authored
Oct 28, 2011
by
Ralf Schmitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test sendall with str, unicode and array
array fails, see
http://code.google.com/p/gevent/issues/detail?id=94
parent
4e794ff5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
greentest/test__socket.py
greentest/test__socket.py
+31
-0
No files found.
greentest/test__socket.py
View file @
2e5038e2
import
os
import
sys
import
array
import
gevent
from
gevent
import
socket
import
greentest
...
...
@@ -9,6 +10,7 @@ import time
class
TestTCP
(
greentest
.
TestCase
):
TIMEOUT_ERROR
=
socket
.
timeout
long_data
=
", "
.
join
([
str
(
x
)
for
x
in
range
(
20000
)])
def
setUp
(
self
):
greentest
.
TestCase
.
setUp
(
self
)
...
...
@@ -21,6 +23,35 @@ class TestTCP(greentest.TestCase):
def
create_connection
(
self
):
return
socket
.
create_connection
((
'127.0.0.1'
,
self
.
listener
.
getsockname
()[
1
]))
def
sendall
(
self
,
data
):
def
accept_and_read
():
conn
,
addr
=
self
.
listener
.
accept
()
fd
=
conn
.
makefile
()
conn
.
close
()
read
=
fd
.
read
()
fd
.
close
()
return
read
server
=
gevent
.
spawn
(
accept_and_read
)
try
:
client
=
self
.
create_connection
()
client
.
sendall
(
data
)
client
.
close
()
read
=
server
.
get
()
assert
read
==
self
.
long_data
finally
:
server
.
kill
()
def
test_sendall_str
(
self
):
self
.
sendall
(
self
.
long_data
)
def
test_sendall_unicode
(
self
):
self
.
sendall
(
unicode
(
self
.
long_data
))
def
test_sendall_array
(
self
):
data
=
array
.
array
(
"B"
,
self
.
long_data
)
self
.
sendall
(
data
)
def
test_fullduplex
(
self
):
def
server
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment