Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ab9a446f
Commit
ab9a446f
authored
Jul 25, 2014
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Plain Diff
Issue #19875: Fix random test_getsockaddrarg() failure.
parents
f7152db9
e396c363
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
Lib/test/test_socket.py
Lib/test/test_socket.py
+16
-8
No files found.
Lib/test/test_socket.py
View file @
ab9a446f
...
...
@@ -3,6 +3,7 @@ from test import support
import
errno
import
io
import
itertools
import
socket
import
select
import
tempfile
...
...
@@ -1147,17 +1148,24 @@ class GeneralModuleTests(unittest.TestCase):
sock
.
close
()
def
test_getsockaddrarg
(
self
):
host
=
'0.0.0.0'
sock
=
socket
.
socket
()
self
.
addCleanup
(
sock
.
close
)
port
=
support
.
find_unused_port
()
big_port
=
port
+
65536
neg_port
=
port
-
65536
sock
=
socket
.
socket
()
try
:
self
.
assertRaises
(
OverflowError
,
sock
.
bind
,
(
host
,
big_port
))
self
.
assertRaises
(
OverflowError
,
sock
.
bind
,
(
host
,
neg_port
))
sock
.
bind
((
host
,
port
))
finally
:
sock
.
close
()
self
.
assertRaises
(
OverflowError
,
sock
.
bind
,
(
HOST
,
big_port
))
self
.
assertRaises
(
OverflowError
,
sock
.
bind
,
(
HOST
,
neg_port
))
# Since find_unused_port() is inherently subject to race conditions, we
# call it a couple times if necessary.
for
i
in
itertools
.
count
():
port
=
support
.
find_unused_port
()
try
:
sock
.
bind
((
HOST
,
port
))
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
EADDRINUSE
or
i
==
5
:
raise
else
:
break
@
unittest
.
skipUnless
(
os
.
name
==
"nt"
,
"Windows specific"
)
def
test_sock_ioctl
(
self
):
...
...
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