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
61acfd7a
Commit
61acfd7a
authored
Dec 08, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak socket timeouts for CI.
parent
b57e1896
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
src/greentest/greentest.py
src/greentest/greentest.py
+2
-2
src/greentest/test__socket_close.py
src/greentest/test__socket_close.py
+8
-6
No files found.
src/greentest/greentest.py
View file @
61acfd7a
...
...
@@ -376,10 +376,10 @@ class TestCaseMetaClass(type):
# Travis is slow and overloaded; Appveyor used to be faster, but
# as of Dec 2015 it's almost always slower and/or has much worse timer
# resolution
CI_TIMEOUT
=
7
CI_TIMEOUT
=
10
if
PY3
and
PYPY
:
# pypy3 is very slow right now
CI_TIMEOUT
=
1
0
CI_TIMEOUT
=
1
5
LOCAL_TIMEOUT
=
1
DEFAULT_LOCAL_HOST_ADDR
=
'localhost'
...
...
src/greentest/test__socket_close.py
View file @
61acfd7a
...
...
@@ -6,9 +6,10 @@ import greentest
# XXX also test: send, sendall, recvfrom, recvfrom_into, sendto
def
readall
(
sock
et
,
address
):
while
sock
et
.
recv
(
1024
):
def
readall
(
sock
,
_
):
while
sock
.
recv
(
1024
):
pass
sock
.
close
()
class
Test
(
greentest
.
TestCase
):
...
...
@@ -16,7 +17,7 @@ class Test(greentest.TestCase):
error_fatal
=
False
def
setUp
(
self
):
self
.
server
=
server
.
StreamServer
((
'127.0.0.1'
,
0
),
readall
)
self
.
server
=
server
.
StreamServer
((
greentest
.
DEFAULT_BIND_ADDR
,
0
),
readall
)
self
.
server
.
start
()
def
tearDown
(
self
):
...
...
@@ -24,7 +25,7 @@ class Test(greentest.TestCase):
def
test_recv_closed
(
self
):
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
.
connect
((
'localhost'
,
self
.
server
.
server_port
))
sock
.
connect
((
greentest
.
DEFAULT_LOCAL_HOST_ADDR
,
self
.
server
.
server_port
))
receiver
=
gevent
.
spawn
(
sock
.
recv
,
25
)
try
:
gevent
.
sleep
(
0.001
)
...
...
@@ -32,14 +33,14 @@ class Test(greentest.TestCase):
receiver
.
join
(
timeout
=
0.1
)
assert
receiver
.
ready
(),
receiver
self
.
assertEqual
(
receiver
.
value
,
None
)
assert
isi
nstance
(
receiver
.
exception
,
socket
.
error
)
self
.
assertIsI
nstance
(
receiver
.
exception
,
socket
.
error
)
self
.
assertEqual
(
receiver
.
exception
.
errno
,
socket
.
EBADF
)
finally
:
receiver
.
kill
()
def
test_recv_twice
(
self
):
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
.
connect
((
'localhost'
,
self
.
server
.
server_port
))
sock
.
connect
((
greentest
.
DEFAULT_LOCAL_HOST_ADDR
,
self
.
server
.
server_port
))
receiver
=
gevent
.
spawn
(
sock
.
recv
,
25
)
try
:
gevent
.
sleep
(
0.001
)
...
...
@@ -47,6 +48,7 @@ class Test(greentest.TestCase):
self
.
assertRaises
(
AssertionError
,
sock
.
recv
,
25
)
finally
:
receiver
.
kill
()
sock
.
close
()
if
__name__
==
'__main__'
:
...
...
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