Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b0519f9

Browse filesBrowse files
Move the cleanup to the class teardown.
1 parent af52044 commit b0519f9
Copy full SHA for b0519f9

File tree

1 file changed

+9
-3
lines changed
Filter options

1 file changed

+9
-3
lines changed

‎Lib/test/test_concurrent_futures/test_interpreter_pool.py

Copy file name to clipboardExpand all lines: Lib/test/test_concurrent_futures/test_interpreter_pool.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,15 @@ def test_idle_thread_reuse(self):
282282

283283
class AsyncioTest(InterpretersMixin, testasyncio_utils.TestCase):
284284

285+
@classmethod
286+
def setUpClass(cls):
287+
policy = support.maybe_get_event_loop_policy()
288+
assert policy is None, policy
289+
290+
@classmethod
291+
def tearDownClass(cls):
292+
asyncio.set_event_loop_policy(None)
293+
285294
def setUp(self):
286295
super().setUp()
287296
self.loop = asyncio.new_event_loop()
@@ -290,9 +299,6 @@ def setUp(self):
290299
self.executor = self.executor_type()
291300
self.addCleanup(lambda: self.executor.shutdown())
292301

293-
if support.maybe_get_event_loop_policy() is None:
294-
self.addCleanup(lambda: asyncio.set_event_loop_policy(None))
295-
296302
def tearDown(self):
297303
if not self.loop.is_closed():
298304
testasyncio_utils.run_briefly(self.loop)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.