Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move the cleanup to the class teardown.
  • Loading branch information
ericsnowcurrently committed Oct 18, 2024
commit b0519f9a2818277c3e40649f835a512c8ed15d47
12 changes: 9 additions & 3 deletions Lib/test/test_concurrent_futures/test_interpreter_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ def test_idle_thread_reuse(self):

class AsyncioTest(InterpretersMixin, testasyncio_utils.TestCase):

@classmethod
def setUpClass(cls):
policy = support.maybe_get_event_loop_policy()
assert policy is None, policy

@classmethod
def tearDownClass(cls):
asyncio.set_event_loop_policy(None)

Comment thread
ZeroIntensity marked this conversation as resolved.
def setUp(self):
super().setUp()
self.loop = asyncio.new_event_loop()
Expand All @@ -290,9 +299,6 @@ def setUp(self):
self.executor = self.executor_type()
self.addCleanup(lambda: self.executor.shutdown())

if support.maybe_get_event_loop_policy() is None:
self.addCleanup(lambda: asyncio.set_event_loop_policy(None))

def tearDown(self):
if not self.loop.is_closed():
testasyncio_utils.run_briefly(self.loop)
Expand Down