Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ee2538be
Kaydet (Commit)
ee2538be
authored
Eki 17, 2010
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix Issue10119 - test_urllibnet failure when using support.transient_internet.
üst
6f4e68d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
20 deletions
+10
-20
test_urllibnet.py
Lib/test/test_urllibnet.py
+10
-20
No files found.
Lib/test/test_urllibnet.py
Dosyayı görüntüle @
ee2538be
...
@@ -11,21 +11,6 @@ import email.message
...
@@ -11,21 +11,6 @@ import email.message
import
time
import
time
def
_open_with_retry
(
func
,
host
,
*
args
,
**
kwargs
):
# Connecting to remote hosts is flaky. Make it more robust
# by retrying the connection several times.
last_exc
=
None
for
i
in
range
(
3
):
try
:
return
func
(
host
,
*
args
,
**
kwargs
)
except
IOError
as
err
:
last_exc
=
err
continue
except
:
raise
raise
last_exc
class
URLTimeoutTest
(
unittest
.
TestCase
):
class
URLTimeoutTest
(
unittest
.
TestCase
):
TIMEOUT
=
10.0
TIMEOUT
=
10.0
...
@@ -37,7 +22,8 @@ class URLTimeoutTest(unittest.TestCase):
...
@@ -37,7 +22,8 @@ class URLTimeoutTest(unittest.TestCase):
socket
.
setdefaulttimeout
(
None
)
socket
.
setdefaulttimeout
(
None
)
def
testURLread
(
self
):
def
testURLread
(
self
):
f
=
_open_with_retry
(
urllib
.
request
.
urlopen
,
"http://www.python.org/"
)
with
support
.
transient_internet
(
"www.python.org"
):
f
=
urllib
.
request
.
urlopen
(
"http://www.python.org/"
)
x
=
f
.
read
()
x
=
f
.
read
()
class
urlopenNetworkTests
(
unittest
.
TestCase
):
class
urlopenNetworkTests
(
unittest
.
TestCase
):
...
@@ -55,8 +41,10 @@ class urlopenNetworkTests(unittest.TestCase):
...
@@ -55,8 +41,10 @@ class urlopenNetworkTests(unittest.TestCase):
"""
"""
def
urlopen
(
self
,
*
args
):
def
urlopen
(
self
,
*
args
,
**
kwargs
):
return
_open_with_retry
(
urllib
.
request
.
urlopen
,
*
args
)
resource
=
args
[
0
]
with
support
.
transient_internet
(
resource
):
return
urllib
.
request
.
urlopen
(
*
args
,
**
kwargs
)
def
test_basic
(
self
):
def
test_basic
(
self
):
# Simple test expected to pass.
# Simple test expected to pass.
...
@@ -119,7 +107,7 @@ class urlopenNetworkTests(unittest.TestCase):
...
@@ -119,7 +107,7 @@ class urlopenNetworkTests(unittest.TestCase):
# test can't pass on Windows.
# test can't pass on Windows.
return
return
# Make sure fd returned by fileno is valid.
# Make sure fd returned by fileno is valid.
open_url
=
self
.
urlopen
(
"http://www.python.org/"
)
open_url
=
self
.
urlopen
(
"http://www.python.org/"
,
timeout
=
None
)
fd
=
open_url
.
fileno
()
fd
=
open_url
.
fileno
()
FILE
=
os
.
fdopen
(
fd
,
encoding
=
'utf-8'
)
FILE
=
os
.
fdopen
(
fd
,
encoding
=
'utf-8'
)
try
:
try
:
...
@@ -146,7 +134,9 @@ class urlretrieveNetworkTests(unittest.TestCase):
...
@@ -146,7 +134,9 @@ class urlretrieveNetworkTests(unittest.TestCase):
"""Tests urllib.request.urlretrieve using the network."""
"""Tests urllib.request.urlretrieve using the network."""
def
urlretrieve
(
self
,
*
args
):
def
urlretrieve
(
self
,
*
args
):
return
_open_with_retry
(
urllib
.
request
.
urlretrieve
,
*
args
)
resource
=
args
[
0
]
with
support
.
transient_internet
(
resource
):
return
urllib
.
request
.
urlretrieve
(
*
args
)
def
test_basic
(
self
):
def
test_basic
(
self
):
# Test basic functionality.
# Test basic functionality.
...
...
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