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
d36a7163
Commit
d36a7163
authored
Mar 07, 2017
by
Xiang Zhang
Committed by
GitHub
Mar 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-28728: clarify possible test failure due to ISP (GH-412)
parent
fea96765
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
Lib/test/test_socket.py
Lib/test/test_socket.py
+15
-5
No files found.
Lib/test/test_socket.py
View file @
d36a7163
...
@@ -803,11 +803,6 @@ class GeneralModuleTests(unittest.TestCase):
...
@@ -803,11 +803,6 @@ class GeneralModuleTests(unittest.TestCase):
self
.
fail
(
"Error testing host resolution mechanisms. (fqdn: %s, all: %s)"
%
(
fqhn
,
repr
(
all_host_names
)))
self
.
fail
(
"Error testing host resolution mechanisms. (fqdn: %s, all: %s)"
%
(
fqhn
,
repr
(
all_host_names
)))
def
test_host_resolution
(
self
):
def
test_host_resolution
(
self
):
for
addr
in
[
'0.1.1.~1'
,
'1+.1.1.1'
,
'::1q'
,
'::1::2'
,
'1:1:1:1:1:1:1:1:1'
]:
self
.
assertRaises
(
OSError
,
socket
.
gethostbyname
,
addr
)
self
.
assertRaises
(
OSError
,
socket
.
gethostbyaddr
,
addr
)
for
addr
in
[
support
.
HOST
,
'10.0.0.1'
,
'255.255.255.255'
]:
for
addr
in
[
support
.
HOST
,
'10.0.0.1'
,
'255.255.255.255'
]:
self
.
assertEqual
(
socket
.
gethostbyname
(
addr
),
addr
)
self
.
assertEqual
(
socket
.
gethostbyname
(
addr
),
addr
)
...
@@ -816,6 +811,21 @@ class GeneralModuleTests(unittest.TestCase):
...
@@ -816,6 +811,21 @@ class GeneralModuleTests(unittest.TestCase):
for
host
in
[
support
.
HOST
]:
for
host
in
[
support
.
HOST
]:
self
.
assertIn
(
host
,
socket
.
gethostbyaddr
(
host
)[
2
])
self
.
assertIn
(
host
,
socket
.
gethostbyaddr
(
host
)[
2
])
def
test_host_resolution_bad_address
(
self
):
# These are all malformed IP addresses and expected not to resolve to
# any result. But some ISPs, e.g. AWS, may successfully resolve these
# IPs.
explanation
=
(
"resolving an invalid IP address did not raise OSError; "
"can be caused by a broken DNS server"
)
for
addr
in
[
'0.1.1.~1'
,
'1+.1.1.1'
,
'::1q'
,
'::1::2'
,
'1:1:1:1:1:1:1:1:1'
]:
with
self
.
assertRaises
(
OSError
):
socket
.
gethostbyname
(
addr
)
with
self
.
assertRaises
(
OSError
,
msg
=
explanation
):
socket
.
gethostbyaddr
(
addr
)
@
unittest
.
skipUnless
(
hasattr
(
socket
,
'sethostname'
),
"test needs socket.sethostname()"
)
@
unittest
.
skipUnless
(
hasattr
(
socket
,
'sethostname'
),
"test needs socket.sethostname()"
)
@
unittest
.
skipUnless
(
hasattr
(
socket
,
'gethostname'
),
"test needs socket.gethostname()"
)
@
unittest
.
skipUnless
(
hasattr
(
socket
,
'gethostname'
),
"test needs socket.gethostname()"
)
def
test_sethostname
(
self
):
def
test_sethostname
(
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