await asyncio.sleep(0.1, loop=self.loop)
return 10
- task = self.new_task(self.loop, foo())
+ coro = foo()
+ task = self.new_task(self.loop, coro)
Future.set_result(task, 'spam')
self.assertEqual(
r'step\(\): already done'):
raise exc
+ coro.close()
+
def test_set_exception_causes_invalid_state(self):
class MyExc(Exception):
pass
await asyncio.sleep(0.1, loop=self.loop)
return 10
- task = self.new_task(self.loop, foo())
+ coro = foo()
+ task = self.new_task(self.loop, coro)
Future.set_exception(task, MyExc())
with self.assertRaises(MyExc):
r'step\(\): already done'):
raise exc
+ coro.close()
+
@unittest.skipUnless(hasattr(futures, '_CFuture') and
hasattr(tasks, '_CTask'),