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
9846de1d
Kaydet (Commit)
9846de1d
authored
Ock 27, 2008
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Retry connection in case it fails to reduce flakiness
üst
041ee5d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
test_socket_ssl.py
Lib/test/test_socket_ssl.py
+30
-3
No files found.
Lib/test/test_socket_ssl.py
Dosyayı görüntüle @
9846de1d
...
...
@@ -14,8 +14,22 @@ import urllib
# Optionally test SSL support, if we have it in the tested platform
skip_expected
=
not
hasattr
(
socket
,
"ssl"
)
class
ConnectedTests
(
unittest
.
TestCase
):
def
urlopen
(
self
,
host
,
*
args
,
**
kwargs
):
# Connecting to remote hosts is flaky. Make it more robust
# by retrying the connection several times.
for
i
in
range
(
3
):
try
:
return
urllib
.
urlopen
(
host
,
*
args
,
**
kwargs
)
except
IOError
,
e
:
last_exc
=
e
continue
except
:
raise
raise
last_exc
def
testBasic
(
self
):
socket
.
RAND_status
()
try
:
...
...
@@ -27,7 +41,7 @@ class ConnectedTests(unittest.TestCase):
socket
.
RAND_add
(
"this is a random string"
,
75.0
)
with
test_support
.
transient_internet
():
f
=
urllib
.
urlopen
(
'https://sf.net'
)
f
=
self
.
urlopen
(
'https://sf.net'
)
buf
=
f
.
read
()
f
.
close
()
...
...
@@ -36,7 +50,7 @@ class ConnectedTests(unittest.TestCase):
print
>>
sys
.
stderr
,
"""
\
WARNING: an attempt to connect to
%
r
%
s, in
test_timeout. That may be legitimate, but is not the outcome we
hoped for. If this message is seen often, test
_t
imeout should be
hoped for. If this message is seen often, test
T
imeout should be
changed to use a more reliable address."""
%
(
ADDR
,
extra_msg
)
# A service which issues a welcome banner (without need to write
...
...
@@ -103,6 +117,19 @@ class BasicTests(unittest.TestCase):
connector
()
t
.
join
()
def
connect
(
self
,
s
,
host_port
):
# Connecting to remote hosts is flaky. Make it more robust
# by retrying the connection several times.
for
i
in
range
(
3
):
try
:
return
s
.
connect
(
host_port
)
except
IOError
,
e
:
last_exc
=
e
continue
except
:
raise
raise
last_exc
def
test_978833
(
self
):
if
test_support
.
verbose
:
print
"test_978833 ..."
...
...
@@ -110,7 +137,7 @@ class BasicTests(unittest.TestCase):
import
os
,
httplib
,
ssl
with
test_support
.
transient_internet
():
s
=
socket
.
socket
(
socket
.
AF_INET
)
s
.
connect
(
(
"svn.python.org"
,
443
))
s
elf
.
connect
(
s
,
(
"svn.python.org"
,
443
))
fd
=
s
.
_sock
.
fileno
()
sock
=
ssl
.
wrap_socket
(
s
)
s
=
None
...
...
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