8000 Move the cleanup to the class teardown. · python/cpython@b0519f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0519f9

Browse files
Move the cleanup to the class teardown.
1 parent af52044 commit b0519f9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Lib/test/test_concurrent_futures/test_interpreter_pool.py

Lines 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