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
f38f7f3c
Kaydet (Commit)
f38f7f3c
authored
Kas 14, 2013
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Avoid ResourceWarning. Fix issue 19580 by Vajrasky Kok.
üst
49d04793
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+18
-4
No files found.
Lib/test/test_asyncio/test_base_events.py
Dosyayı görüntüle @
f38f7f3c
...
...
@@ -458,16 +458,26 @@ class BaseEventLoopWithSelectorTests(unittest.TestCase):
self
.
loop
.
sock_connect
.
return_value
=
()
self
.
loop
.
_make_ssl_transport
=
unittest
.
mock
.
Mock
()
class
_SelectorTransportMock
:
_sock
=
None
def
close
(
self
):
self
.
_sock
.
close
()
def
mock_make_ssl_transport
(
sock
,
protocol
,
sslcontext
,
waiter
,
**
kwds
):
waiter
.
set_result
(
None
)
transport
=
_SelectorTransportMock
()
transport
.
_sock
=
sock
return
transport
self
.
loop
.
_make_ssl_transport
.
side_effect
=
mock_make_ssl_transport
ANY
=
unittest
.
mock
.
ANY
# First try the default server_hostname.
self
.
loop
.
_make_ssl_transport
.
reset_mock
()
coro
=
self
.
loop
.
create_connection
(
MyProto
,
'python.org'
,
80
,
ssl
=
True
)
self
.
loop
.
run_until_complete
(
coro
)
transport
,
_
=
self
.
loop
.
run_until_complete
(
coro
)
transport
.
close
()
self
.
loop
.
_make_ssl_transport
.
assert_called_with
(
ANY
,
ANY
,
ANY
,
ANY
,
server_side
=
False
,
...
...
@@ -476,7 +486,8 @@ class BaseEventLoopWithSelectorTests(unittest.TestCase):
self
.
loop
.
_make_ssl_transport
.
reset_mock
()
coro
=
self
.
loop
.
create_connection
(
MyProto
,
'python.org'
,
80
,
ssl
=
True
,
server_hostname
=
'perl.com'
)
self
.
loop
.
run_until_complete
(
coro
)
transport
,
_
=
self
.
loop
.
run_until_complete
(
coro
)
transport
.
close
()
self
.
loop
.
_make_ssl_transport
.
assert_called_with
(
ANY
,
ANY
,
ANY
,
ANY
,
server_side
=
False
,
...
...
@@ -485,7 +496,8 @@ class BaseEventLoopWithSelectorTests(unittest.TestCase):
self
.
loop
.
_make_ssl_transport
.
reset_mock
()
coro
=
self
.
loop
.
create_connection
(
MyProto
,
'python.org'
,
80
,
ssl
=
True
,
server_hostname
=
''
)
self
.
loop
.
run_until_complete
(
coro
)
transport
,
_
=
self
.
loop
.
run_until_complete
(
coro
)
transport
.
close
()
self
.
loop
.
_make_ssl_transport
.
assert_called_with
(
ANY
,
ANY
,
ANY
,
ANY
,
server_side
=
False
,
server_hostname
=
''
)
...
...
@@ -505,8 +517,10 @@ class BaseEventLoopWithSelectorTests(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
self
.
loop
.
run_until_complete
,
coro
)
coro
=
self
.
loop
.
create_connection
(
MyProto
,
None
,
80
,
ssl
=
True
)
self
.
assertRaises
(
ValueError
,
self
.
loop
.
run_until_complete
,
coro
)
sock
=
socket
.
socket
()
coro
=
self
.
loop
.
create_connection
(
MyProto
,
None
,
None
,
ssl
=
True
,
sock
=
socket
.
socket
())
ssl
=
True
,
sock
=
sock
)
self
.
addCleanup
(
sock
.
close
)
self
.
assertRaises
(
ValueError
,
self
.
loop
.
run_until_complete
,
coro
)
def
test_create_server_empty_host
(
self
):
...
...
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