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
d20afad7
Kaydet (Commit)
d20afad7
authored
Eki 19, 2013
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19305: try to fix sporadic test_asyncio failure on FreeBSD 10.0
üst
0d9eefda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
test_utils.py
Lib/asyncio/test_utils.py
+15
-0
test_events.py
Lib/test/test_asyncio/test_events.py
+5
-2
No files found.
Lib/asyncio/test_utils.py
Dosyayı görüntüle @
d20afad7
...
@@ -7,6 +7,7 @@ import unittest.mock
...
@@ -7,6 +7,7 @@ import unittest.mock
import
os
import
os
import
sys
import
sys
import
threading
import
threading
import
time
import
unittest
import
unittest
import
unittest.mock
import
unittest.mock
from
wsgiref.simple_server
import
make_server
,
WSGIRequestHandler
,
WSGIServer
from
wsgiref.simple_server
import
make_server
,
WSGIRequestHandler
,
WSGIServer
...
@@ -46,6 +47,20 @@ def run_briefly(loop):
...
@@ -46,6 +47,20 @@ def run_briefly(loop):
gen
.
close
()
gen
.
close
()
def
run_until
(
loop
,
pred
,
timeout
=
None
):
if
timeout
is
not
None
:
deadline
=
time
.
time
()
+
timeout
while
not
pred
():
if
timeout
is
not
None
:
timeout
=
deadline
-
time
.
time
()
if
timeout
<=
0
:
return
False
loop
.
run_until_complete
(
tasks
.
sleep
(
timeout
,
loop
=
loop
))
else
:
run_briefly
(
loop
)
return
True
def
run_once
(
loop
):
def
run_once
(
loop
):
"""loop.stop() schedules _raise_stop_error()
"""loop.stop() schedules _raise_stop_error()
and run_forever() runs until _raise_stop_error() callback.
and run_forever() runs until _raise_stop_error() callback.
...
...
Lib/test/test_asyncio/test_events.py
Dosyayı görüntüle @
d20afad7
...
@@ -558,13 +558,14 @@ class EventLoopTestsMixin:
...
@@ -558,13 +558,14 @@ class EventLoopTestsMixin:
self
.
assertEqual
(
host
,
'0.0.0.0'
)
self
.
assertEqual
(
host
,
'0.0.0.0'
)
client
=
socket
.
socket
()
client
=
socket
.
socket
()
client
.
connect
((
'127.0.0.1'
,
port
))
client
.
connect
((
'127.0.0.1'
,
port
))
client
.
send
(
b
'xxx'
)
client
.
send
all
(
b
'xxx'
)
test_utils
.
run_briefly
(
self
.
loop
)
test_utils
.
run_briefly
(
self
.
loop
)
self
.
assertIsInstance
(
proto
,
MyProto
)
self
.
assertIsInstance
(
proto
,
MyProto
)
self
.
assertEqual
(
'INITIAL'
,
proto
.
state
)
self
.
assertEqual
(
'INITIAL'
,
proto
.
state
)
test_utils
.
run_briefly
(
self
.
loop
)
test_utils
.
run_briefly
(
self
.
loop
)
self
.
assertEqual
(
'CONNECTED'
,
proto
.
state
)
self
.
assertEqual
(
'CONNECTED'
,
proto
.
state
)
test_utils
.
run_briefly
(
self
.
loop
)
# windows iocp
test_utils
.
run_until
(
self
.
loop
,
lambda
:
proto
.
nbytes
>
0
,
timeout
=
10
)
self
.
assertEqual
(
3
,
proto
.
nbytes
)
self
.
assertEqual
(
3
,
proto
.
nbytes
)
# extra info is available
# extra info is available
...
@@ -623,6 +624,8 @@ class EventLoopTestsMixin:
...
@@ -623,6 +624,8 @@ class EventLoopTestsMixin:
self
.
assertIsInstance
(
proto
,
MyProto
)
self
.
assertIsInstance
(
proto
,
MyProto
)
test_utils
.
run_briefly
(
self
.
loop
)
test_utils
.
run_briefly
(
self
.
loop
)
self
.
assertEqual
(
'CONNECTED'
,
proto
.
state
)
self
.
assertEqual
(
'CONNECTED'
,
proto
.
state
)
test_utils
.
run_until
(
self
.
loop
,
lambda
:
proto
.
nbytes
>
0
,
timeout
=
10
)
self
.
assertEqual
(
3
,
proto
.
nbytes
)
self
.
assertEqual
(
3
,
proto
.
nbytes
)
# extra info is available
# extra info is available
...
...
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