Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4112c5b9
Commit
4112c5b9
authored
Jan 26, 2018
by
Yury Selivanov
Committed by
GitHub
Jan 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-32662: Try making test_asyncio.test_server more reliable (#5338)
parent
863b1e4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
Lib/test/test_asyncio/test_server.py
Lib/test/test_asyncio/test_server.py
+12
-1
No files found.
Lib/test/test_asyncio/test_server.py
View file @
4112c5b9
import
asyncio
import
socket
import
time
import
threading
import
unittest
from
test
import
support
from
test.test_asyncio
import
utils
as
test_utils
from
test.test_asyncio
import
functional
as
func_tests
...
...
@@ -16,6 +18,14 @@ class BaseStartServer(func_tests.FunctionalTestCaseMixin):
HELLO_MSG
=
b'1'
*
1024
*
5
+
b'
\
n
'
def
client
(
sock
,
addr
):
for
i
in
range
(
10
):
time
.
sleep
(
0.2
)
if
srv
.
is_serving
():
break
else
:
raise
RuntimeError
sock
.
settimeout
(
2
)
sock
.
connect
(
addr
)
sock
.
send
(
HELLO_MSG
)
sock
.
recv_all
(
1
)
...
...
@@ -33,7 +43,7 @@ class BaseStartServer(func_tests.FunctionalTestCaseMixin):
await
srv
.
serve_forever
()
srv
=
self
.
loop
.
run_until_complete
(
asyncio
.
start_server
(
serve
,
'127.0.0.1'
,
0
,
loop
=
self
.
loop
,
start_serving
=
False
))
serve
,
support
.
HOSTv4
,
0
,
loop
=
self
.
loop
,
start_serving
=
False
))
self
.
assertFalse
(
srv
.
is_serving
())
...
...
@@ -65,6 +75,7 @@ class SelectorStartServerTests(BaseStartServer, unittest.TestCase):
started
=
threading
.
Event
()
def
client
(
sock
,
addr
):
sock
.
settimeout
(
2
)
started
.
wait
(
5
)
sock
.
connect
(
addr
)
sock
.
send
(
HELLO_MSG
)
...
...
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