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
a763c063
Kaydet (Commit)
a763c063
authored
Eki 27, 2009
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Suppress transient refleaks in test_smtplib.
üst
b218d289
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
test_smtplib.py
Lib/test/test_smtplib.py
+20
-4
No files found.
Lib/test/test_smtplib.py
Dosyayı görüntüle @
a763c063
...
...
@@ -39,17 +39,21 @@ def server(evt, buf, serv):
class
GeneralTests
(
TestCase
):
def
setUp
(
self
):
self
.
_threads
=
test_support
.
threading_setup
()
self
.
evt
=
threading
.
Event
()
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
settimeout
(
15
)
self
.
port
=
test_support
.
bind_port
(
self
.
sock
)
servargs
=
(
self
.
evt
,
"220 Hola mundo
\n
"
,
self
.
sock
)
threading
.
Thread
(
target
=
server
,
args
=
servargs
)
.
start
()
self
.
thread
=
threading
.
Thread
(
target
=
server
,
args
=
servargs
)
self
.
thread
.
start
()
self
.
evt
.
wait
()
self
.
evt
.
clear
()
def
tearDown
(
self
):
self
.
evt
.
wait
()
self
.
thread
.
join
()
test_support
.
threading_cleanup
(
*
self
.
_threads
)
def
testBasic1
(
self
):
# connects
...
...
@@ -142,12 +146,14 @@ class DebuggingServerTests(TestCase):
self
.
output
=
StringIO
.
StringIO
()
sys
.
stdout
=
self
.
output
self
.
_threads
=
test_support
.
threading_setup
()
self
.
serv_evt
=
threading
.
Event
()
self
.
client_evt
=
threading
.
Event
()
self
.
port
=
test_support
.
find_unused_port
()
self
.
serv
=
smtpd
.
DebuggingServer
((
HOST
,
self
.
port
),
(
'nowhere'
,
-
1
))
serv_args
=
(
self
.
serv
,
self
.
serv_evt
,
self
.
client_evt
)
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
.
start
()
self
.
thread
=
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
self
.
thread
.
start
()
# wait until server thread has assigned a port number
self
.
serv_evt
.
wait
()
...
...
@@ -158,6 +164,8 @@ class DebuggingServerTests(TestCase):
self
.
client_evt
.
set
()
# wait for the server thread to terminate
self
.
serv_evt
.
wait
()
self
.
thread
.
join
()
test_support
.
threading_cleanup
(
*
self
.
_threads
)
# restore sys.stdout
sys
.
stdout
=
self
.
old_stdout
...
...
@@ -253,17 +261,21 @@ class BadHELOServerTests(TestCase):
self
.
output
=
StringIO
.
StringIO
()
sys
.
stdout
=
self
.
output
self
.
_threads
=
test_support
.
threading_setup
()
self
.
evt
=
threading
.
Event
()
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
settimeout
(
15
)
self
.
port
=
test_support
.
bind_port
(
self
.
sock
)
servargs
=
(
self
.
evt
,
"199 no hello for you!
\n
"
,
self
.
sock
)
threading
.
Thread
(
target
=
server
,
args
=
servargs
)
.
start
()
self
.
thread
=
threading
.
Thread
(
target
=
server
,
args
=
servargs
)
self
.
thread
.
start
()
self
.
evt
.
wait
()
self
.
evt
.
clear
()
def
tearDown
(
self
):
self
.
evt
.
wait
()
self
.
thread
.
join
()
test_support
.
threading_cleanup
(
*
self
.
_threads
)
sys
.
stdout
=
self
.
old_stdout
def
testFailingHELO
(
self
):
...
...
@@ -369,12 +381,14 @@ class SimSMTPServer(smtpd.SMTPServer):
class
SMTPSimTests
(
TestCase
):
def
setUp
(
self
):
self
.
_threads
=
test_support
.
threading_setup
()
self
.
serv_evt
=
threading
.
Event
()
self
.
client_evt
=
threading
.
Event
()
self
.
port
=
test_support
.
find_unused_port
()
self
.
serv
=
SimSMTPServer
((
HOST
,
self
.
port
),
(
'nowhere'
,
-
1
))
serv_args
=
(
self
.
serv
,
self
.
serv_evt
,
self
.
client_evt
)
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
.
start
()
self
.
thread
=
threading
.
Thread
(
target
=
debugging_server
,
args
=
serv_args
)
self
.
thread
.
start
()
# wait until server thread has assigned a port number
self
.
serv_evt
.
wait
()
...
...
@@ -385,6 +399,8 @@ class SMTPSimTests(TestCase):
self
.
client_evt
.
set
()
# wait for the server thread to terminate
self
.
serv_evt
.
wait
()
self
.
thread
.
join
()
test_support
.
threading_cleanup
(
*
self
.
_threads
)
def
testBasic
(
self
):
# smoke test
...
...
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