◐ Shell
reader mode source ↗
Skip to content
Merged
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
9 changes: 8 additions & 1 deletion Lib/asyncio/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,19 @@ def get_function_source(func):


class TestCase(unittest.TestCase):
def set_event_loop(self, loop, *, cleanup=True):
assert loop is not None
# ensure that the event loop is passed explicitly in asyncio
events.set_event_loop(None)
if cleanup:
self.addCleanup(loop.close)

def new_test_loop(self, gen=None):
loop = TestLoop(gen)
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_asyncio/test_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ def run(arg):
self.assertTrue(asyncio.isfuture(f2))
self.assertEqual(res, 'oi')
self.assertNotEqual(ident, threading.get_ident())

def test_wrap_future_future(self):
f1 = self._new_future(loop=self.loop)
@@ -395,6 +396,7 @@ def run(arg):
f1 = ex.submit(run, 'oi')
f2 = asyncio.wrap_future(f1)
self.assertIs(self.loop, f2._loop)

def test_wrap_future_cancel(self):
f1 = concurrent.futures.Future()
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_proactor_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ def test_loop_self_reading_fut(self):
self.loop._loop_self_reading)

def test_loop_self_reading_exception(self):
self.loop.close = mock.Mock()
self.loop.call_exception_handler = mock.Mock()
self.proactor.recv.side_effect = OSError()
self.loop._loop_self_reading()
Expand Down
Toggle all file notes Toggle all file annotations