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
bc2c4c99
Commit
bc2c4c99
authored
Sep 17, 2014
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace bad ftp URLs in test_urllib2net
parent
637e4544
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
34 deletions
+34
-34
Lib/test/test_urllib2net.py
Lib/test/test_urllib2net.py
+34
-34
No files found.
Lib/test/test_urllib2net.py
View file @
bc2c4c99
...
...
@@ -103,9 +103,9 @@ class OtherNetworkTests(unittest.TestCase):
def
test_ftp
(
self
):
urls
=
[
'ftp://ftp.
kernel.org/pub/linux/kernel
/README'
,
'ftp://ftp.kernel.org/pub/linux/kernel
/non-existent-file'
,
#'ftp://ftp.kernel.org/pub/leenox/kernel/test'
,
'ftp://ftp.
debian.org/debian
/README'
,
(
'ftp://ftp.debian.org/debian
/non-existent-file'
,
None
,
urllib
.
error
.
URLError
)
,
'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC'
'/research-reports/00README-Legal-Rules-Regs'
,
]
...
...
@@ -215,39 +215,39 @@ class OtherNetworkTests(unittest.TestCase):
urlopen
=
_wrap_with_retry_thrice
(
urlopen
,
urllib
.
error
.
URLError
)
for
url
in
urls
:
if
isinstance
(
url
,
tuple
):
url
,
req
,
expected_err
=
url
else
:
req
=
expected_err
=
None
with
support
.
transient_internet
(
url
):
debug
(
url
)
try
:
f
=
urlopen
(
url
,
req
,
TIMEOUT
)
except
OSError
as
err
:
debug
(
err
)
if
expected_err
:
msg
=
(
"Didn't get expected error(s) %s for %s %s, got %s: %s"
%
(
expected_err
,
url
,
req
,
type
(
err
),
err
))
self
.
assertIsInstance
(
err
,
expected_err
,
msg
)
except
urllib
.
error
.
URLError
as
err
:
if
isinstance
(
err
[
0
],
socket
.
timeout
):
print
(
"<timeout: %s>"
%
url
,
file
=
sys
.
stderr
)
continue
else
:
raise
with
self
.
subTest
(
url
=
url
):
if
isinstance
(
url
,
tuple
):
url
,
req
,
expected_err
=
url
else
:
req
=
expected_err
=
None
with
support
.
transient_internet
(
url
):
try
:
with
support
.
time_out
,
\
support
.
socket_peer_reset
,
\
support
.
ioerror_peer_reset
:
buf
=
f
.
read
()
debug
(
"read %d bytes"
%
len
(
buf
))
except
socket
.
timeout
:
print
(
"<timeout: %s>"
%
url
,
file
=
sys
.
stderr
)
f
.
close
()
debug
(
"******** next url coming up..."
)
time
.
sleep
(
0.1
)
f
=
urlopen
(
url
,
req
,
TIMEOUT
)
except
OSError
as
err
:
if
expected_err
:
msg
=
(
"Didn't get expected error(s) %s for %s %s, got %s: %s"
%
(
expected_err
,
url
,
req
,
type
(
err
),
err
))
self
.
assertIsInstance
(
err
,
expected_err
,
msg
)
else
:
raise
except
urllib
.
error
.
URLError
as
err
:
if
isinstance
(
err
[
0
],
socket
.
timeout
):
print
(
"<timeout: %s>"
%
url
,
file
=
sys
.
stderr
)
continue
else
:
raise
else
:
try
:
with
support
.
time_out
,
\
support
.
socket_peer_reset
,
\
support
.
ioerror_peer_reset
:
buf
=
f
.
read
()
debug
(
"read %d bytes"
%
len
(
buf
))
except
socket
.
timeout
:
print
(
"<timeout: %s>"
%
url
,
file
=
sys
.
stderr
)
f
.
close
()
time
.
sleep
(
0.1
)
def
_extra_handlers
(
self
):
handlers
=
[]
...
...
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