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
b4aca9f5
Commit
b4aca9f5
authored
Dec 01, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test tweaks for CI.
parent
4d2f9efd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
9 deletions
+20
-9
src/gevent/socket.py
src/gevent/socket.py
+2
-0
src/greentest/greentest.py
src/greentest/greentest.py
+1
-0
src/greentest/test__server.py
src/greentest/test__server.py
+1
-0
src/greentest/test__socket.py
src/greentest/test__socket.py
+1
-1
src/greentest/test__socket_timeout.py
src/greentest/test__socket_timeout.py
+15
-8
No files found.
src/gevent/socket.py
View file @
b4aca9f5
...
@@ -92,6 +92,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
...
@@ -92,6 +92,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
except
error
:
except
error
:
if
sock
is
not
None
:
if
sock
is
not
None
:
sock
.
close
()
sock
.
close
()
sock
=
None
if
res
is
addrs
[
-
1
]:
if
res
is
addrs
[
-
1
]:
raise
raise
# without exc_clear(), if connect() fails once, the socket
# without exc_clear(), if connect() fails once, the socket
...
@@ -113,6 +114,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
...
@@ -113,6 +114,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=N
# close the socket
# close the socket
if
sock
is
not
None
:
if
sock
is
not
None
:
sock
.
close
()
sock
.
close
()
sock
=
None
raise
raise
else
:
else
:
return
sock
return
sock
...
...
src/greentest/greentest.py
View file @
b4aca9f5
...
@@ -403,6 +403,7 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
...
@@ -403,6 +403,7 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
if
hasattr
(
self
,
'cleanup'
):
if
hasattr
(
self
,
'cleanup'
):
self
.
cleanup
()
self
.
cleanup
()
self
.
_error
=
self
.
_none
self
.
_error
=
self
.
_none
# XXX: Should probably reverse this
for
x
in
self
.
close_on_teardown
:
for
x
in
self
.
close_on_teardown
:
close
=
getattr
(
x
,
'close'
,
x
)
close
=
getattr
(
x
,
'close'
,
x
)
try
:
try
:
...
...
src/greentest/test__server.py
View file @
b4aca9f5
...
@@ -383,6 +383,7 @@ class TestPoolSpawn(TestDefaultSpawn):
...
@@ -383,6 +383,7 @@ class TestPoolSpawn(TestDefaultSpawn):
return
2
return
2
@
greentest
.
skipOnAppVeyor
(
"Connection timeouts are flaky"
)
@
greentest
.
skipOnAppVeyor
(
"Connection timeouts are flaky"
)
@
greentest
.
skipOnPyPy3OnCI
(
"Doesn't always raise timeout for some reason"
)
def
test_pool_full
(
self
):
def
test_pool_full
(
self
):
self
.
init_server
()
self
.
init_server
()
short_request
=
self
.
send_request
(
'/short'
)
short_request
=
self
.
send_request
(
'/short'
)
...
...
src/greentest/test__socket.py
View file @
b4aca9f5
...
@@ -322,7 +322,7 @@ def get_port():
...
@@ -322,7 +322,7 @@ def get_port():
class
TestCreateConnection
(
greentest
.
TestCase
):
class
TestCreateConnection
(
greentest
.
TestCase
):
__timeout__
=
5
000
__timeout__
=
5
def
test_refuses
(
self
):
def
test_refuses
(
self
):
with
self
.
assertRaises
(
socket
.
error
)
as
cm
:
with
self
.
assertRaises
(
socket
.
error
)
as
cm
:
...
...
src/greentest/test__socket_timeout.py
View file @
b4aca9f5
...
@@ -10,26 +10,33 @@ class Test(greentest.TestCase):
...
@@ -10,26 +10,33 @@ class Test(greentest.TestCase):
server_port
=
None
server_port
=
None
def
_accept
(
self
):
def
_accept
(
self
):
self
.
server
.
listen
(
1
)
try
:
conn
,
_
=
self
.
server
.
accept
()
conn
,
_
=
self
.
server
.
accept
()
self
.
_close_on_teardown
(
conn
)
self
.
_close_on_teardown
(
conn
)
except
socket
.
error
:
pass
def
setUp
(
self
):
def
setUp
(
self
):
super
(
Test
,
self
).
setUp
()
super
(
Test
,
self
).
setUp
()
self
.
server
=
socket
.
socket
()
self
.
server
=
socket
.
socket
()
self
.
_close_on_teardown
(
self
.
server
)
self
.
_close_on_teardown
(
self
.
server
)
self
.
server
.
bind
((
'127.0.0.1'
,
0
))
self
.
server
.
bind
((
'127.0.0.1'
,
0
))
self
.
server
.
listen
(
1
)
self
.
server_port
=
self
.
server
.
getsockname
()[
1
]
self
.
server_port
=
self
.
server
.
getsockname
()[
1
]
self
.
acceptor
=
gevent
.
spawn
(
self
.
_accept
)
self
.
acceptor
=
gevent
.
spawn
(
self
.
_accept
)
gevent
.
sleep
(
0
)
def
tearDown
(
self
):
def
tearDown
(
self
):
if
self
.
acceptor
is
not
None
:
self
.
acceptor
.
kill
()
self
.
acceptor
.
kill
()
self
.
acceptor
=
None
if
self
.
server
is
not
None
:
self
.
server
.
close
()
self
.
server
.
close
()
del
self
.
acceptor
self
.
server
=
None
del
self
.
server
super
(
Test
,
self
).
tearDown
()
super
(
Test
,
self
).
tearDown
()
def
test
(
self
):
def
test_timeout
(
self
):
gevent
.
sleep
(
0
)
sock
=
socket
.
socket
()
sock
=
socket
.
socket
()
self
.
_close_on_teardown
(
sock
)
self
.
_close_on_teardown
(
sock
)
sock
.
connect
((
'127.0.0.1'
,
self
.
server_port
))
sock
.
connect
((
'127.0.0.1'
,
self
.
server_port
))
...
...
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