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
079931d1
Commit
079931d1
authored
Sep 19, 2019
by
Victor Stinner
Committed by
GitHub
Sep 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34037: test_asyncio uses shutdown_default_executor() (GH-16284)
parent
b2dd2dd6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+6
-0
Lib/test/test_asyncio/test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+2
-0
Lib/test/test_asyncio/utils.py
Lib/test/test_asyncio/utils.py
+5
-3
No files found.
Lib/test/test_asyncio/test_base_events.py
View file @
079931d1
...
...
@@ -216,6 +216,9 @@ class BaseEventLoopTests(test_utils.TestCase):
raise
NotImplementedError
(
'cannot submit into a dummy executor'
)
self
.
loop
.
_process_events
=
mock
.
Mock
()
self
.
loop
.
_write_to_self
=
mock
.
Mock
()
executor
=
DummyExecutor
()
self
.
loop
.
set_default_executor
(
executor
)
self
.
assertIs
(
executor
,
self
.
loop
.
_default_executor
)
...
...
@@ -226,6 +229,9 @@ class BaseEventLoopTests(test_utils.TestCase):
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
loop
.
set_default_executor
(
executor
)
# Avoid cleaning up the executor mock
self
.
loop
.
_default_executor
=
None
def
test_call_soon
(
self
):
def
cb
():
pass
...
...
Lib/test/test_asyncio/test_tasks.py
View file @
079931d1
...
...
@@ -3232,6 +3232,8 @@ class RunCoroutineThreadsafeTests(test_utils.TestCase):
self
.
loop
.
set_exception_handler
(
callback
)
# Set corrupted task factory
self
.
addCleanup
(
self
.
loop
.
set_task_factory
,
self
.
loop
.
get_task_factory
())
self
.
loop
.
set_task_factory
(
task_factory
)
# Run event loop
...
...
Lib/test/test_asyncio/utils.py
View file @
079931d1
...
...
@@ -509,9 +509,11 @@ def get_function_source(func):
class
TestCase
(
unittest
.
TestCase
):
@
staticmethod
def
close_loop
(
loop
):
executor
=
loop
.
_default_executor
if
executor
is
not
None
:
executor
.
shutdown
(
wait
=
True
)
if
loop
.
_default_executor
is
not
None
:
if
not
loop
.
is_closed
():
loop
.
run_until_complete
(
loop
.
shutdown_default_executor
())
else
:
loop
.
_default_executor
.
shutdown
(
wait
=
True
)
loop
.
close
()
policy
=
support
.
maybe_get_event_loop_policy
()
if
policy
is
not
None
:
...
...
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