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
aa03a1fe
Kaydet (Commit)
aa03a1fe
authored
Ara 19, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Small cleanup in test_ftplib
üst
2606a6f1
08d02724
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
test_ftplib.py
Lib/test/test_ftplib.py
+14
-13
No files found.
Lib/test/test_ftplib.py
Dosyayı görüntüle @
aa03a1fe
...
...
@@ -896,39 +896,40 @@ class TestTimeouts(TestCase):
def
setUp
(
self
):
self
.
evt
=
threading
.
Event
()
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
settimeout
(
1
0
)
self
.
sock
.
settimeout
(
2
0
)
self
.
port
=
support
.
bind_port
(
self
.
sock
)
threading
.
Thread
(
target
=
self
.
server
,
args
=
(
self
.
evt
,
self
.
sock
))
.
start
()
self
.
server_thread
=
threading
.
Thread
(
target
=
self
.
server
)
self
.
server_thread
.
start
()
# Wait for the server to be ready.
self
.
evt
.
wait
()
self
.
evt
.
clear
()
self
.
old_port
=
ftplib
.
FTP
.
port
ftplib
.
FTP
.
port
=
self
.
port
def
tearDown
(
self
):
self
.
evt
.
wait
()
self
.
s
ock
.
close
()
ftplib
.
FTP
.
port
=
self
.
old_port
self
.
s
erver_thread
.
join
()
def
server
(
self
,
evt
,
serv
):
def
server
(
self
):
# This method sets the evt 3 times:
# 1) when the connection is ready to be accepted.
# 2) when it is safe for the caller to close the connection
# 3) when we have closed the socket
se
rv
.
listen
(
5
)
se
lf
.
sock
.
listen
(
5
)
# (1) Signal the caller that we are ready to accept the connection.
evt
.
set
()
self
.
evt
.
set
()
try
:
conn
,
addr
=
se
rv
.
accept
()
conn
,
addr
=
se
lf
.
sock
.
accept
()
except
socket
.
timeout
:
pass
else
:
conn
.
send
(
b
"1 Hola mundo
\n
"
)
conn
.
sendall
(
b
"1 Hola mundo
\n
"
)
conn
.
shutdown
(
socket
.
SHUT_WR
)
# (2) Signal the caller that it is safe to close the socket.
evt
.
set
()
self
.
evt
.
set
()
conn
.
close
()
finally
:
serv
.
close
()
# (3) Signal the caller that we are done.
evt
.
set
()
self
.
sock
.
close
()
def
testTimeoutDefault
(
self
):
# default -- use global socket timeout
...
...
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