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
eaca5c8b
Commit
eaca5c8b
authored
Jun 17, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #10883: test_urllib2net closes socket explicitly
parent
a4c45d73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
Lib/test/test_urllib2net.py
Lib/test/test_urllib2net.py
+8
-0
No files found.
Lib/test/test_urllib2net.py
View file @
eaca5c8b
...
...
@@ -234,6 +234,7 @@ class TimeoutTest(unittest.TestCase):
url
=
"http://www.python.org"
with
support
.
transient_internet
(
url
,
timeout
=
None
):
u
=
_urlopen_with_retry
(
url
)
self
.
addCleanup
(
u
.
close
)
self
.
assertTrue
(
u
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
def
test_http_default_timeout
(
self
):
...
...
@@ -243,6 +244,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
url
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertEqual
(
u
.
fp
.
raw
.
_sock
.
gettimeout
(),
60
)
...
...
@@ -254,6 +256,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
url
,
timeout
=
None
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertTrue
(
u
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
...
...
@@ -262,6 +265,7 @@ class TimeoutTest(unittest.TestCase):
url
=
"http://www.python.org"
with
support
.
transient_internet
(
url
):
u
=
_urlopen_with_retry
(
url
,
timeout
=
120
)
self
.
addCleanup
(
u
.
close
)
self
.
assertEqual
(
u
.
fp
.
raw
.
_sock
.
gettimeout
(),
120
)
FTP_HOST
=
"ftp://ftp.mirror.nl/pub/gnu/"
...
...
@@ -270,6 +274,7 @@ class TimeoutTest(unittest.TestCase):
self
.
assertTrue
(
socket
.
getdefaulttimeout
()
is
None
)
with
support
.
transient_internet
(
self
.
FTP_HOST
,
timeout
=
None
):
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
)
self
.
addCleanup
(
u
.
close
)
self
.
assertTrue
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
def
test_ftp_default_timeout
(
self
):
...
...
@@ -278,6 +283,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertEqual
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
(),
60
)
...
...
@@ -288,6 +294,7 @@ class TimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
60
)
try
:
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
,
timeout
=
None
)
self
.
addCleanup
(
u
.
close
)
finally
:
socket
.
setdefaulttimeout
(
None
)
self
.
assertTrue
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
()
is
None
)
...
...
@@ -295,6 +302,7 @@ class TimeoutTest(unittest.TestCase):
def
test_ftp_timeout
(
self
):
with
support
.
transient_internet
(
self
.
FTP_HOST
):
u
=
_urlopen_with_retry
(
self
.
FTP_HOST
,
timeout
=
60
)
self
.
addCleanup
(
u
.
close
)
self
.
assertEqual
(
u
.
fp
.
fp
.
raw
.
_sock
.
gettimeout
(),
60
)
...
...
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