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
ea3f606a
Commit
ea3f606a
authored
Jul 31, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slight improvement in TestCreateConnection
parent
5a5a2a46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
greentest/test__socket.py
greentest/test__socket.py
+11
-11
No files found.
greentest/test__socket.py
View file @
ea3f606a
...
@@ -131,25 +131,25 @@ if hasattr(socket, 'ssl'):
...
@@ -131,25 +131,25 @@ if hasattr(socket, 'ssl'):
return
sock
return
sock
def
get_port
():
tempsock
=
socket
.
socket
()
tempsock
.
bind
((
''
,
0
))
port
=
tempsock
.
getsockname
()[
1
]
tempsock
.
close
()
return
port
class
TestCreateConnection
(
greentest
.
TestCase
):
class
TestCreateConnection
(
greentest
.
TestCase
):
def
test
(
self
):
def
test
(
self
):
tempsock1
=
socket
.
socket
()
tempsock1
.
bind
((
''
,
0
))
source_port
=
tempsock1
.
getsockname
()[
1
]
tempsock2
=
socket
.
socket
()
tempsock2
.
bind
((
''
,
0
))
tempsock2
.
getsockname
()[
1
]
tempsock1
.
close
()
del
tempsock1
tempsock2
.
close
()
del
tempsock2
try
:
try
:
socket
.
create_connection
((
'localhost'
,
4
),
timeout
=
30
,
source_address
=
(
''
,
source_port
))
socket
.
create_connection
((
'localhost'
,
get_port
()),
timeout
=
30
,
source_address
=
(
''
,
get_port
()
))
except
socket
.
error
:
except
socket
.
error
:
ex
=
sys
.
exc_info
()[
1
]
ex
=
sys
.
exc_info
()[
1
]
if
'refused'
not
in
str
(
ex
).
lower
():
if
'refused'
not
in
str
(
ex
).
lower
():
raise
raise
else
:
raise
AssertionError
(
'create_connection did not raise socket.error as expected'
)
if
__name__
==
'__main__'
:
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