(self)
| 925 | self.assertFalse(t.cancelled()) |
| 926 | |
| 927 | def test_cancel_task_ignoring(self): |
| 928 | fut1 = self.new_future(self.loop) |
| 929 | fut2 = self.new_future(self.loop) |
| 930 | fut3 = self.new_future(self.loop) |
| 931 | |
| 932 | async def task(): |
| 933 | await fut1 |
| 934 | try: |
| 935 | await fut2 |
| 936 | except asyncio.CancelledError: |
| 937 | pass |
| 938 | res = await fut3 |
| 939 | return res |
| 940 | |
| 941 | t = self.new_task(self.loop, task()) |
| 942 | test_utils.run_briefly(self.loop) |
| 943 | self.assertIs(t._fut_waiter, fut1) # White-box test. |
| 944 | fut1.set_result(None) |
| 945 | test_utils.run_briefly(self.loop) |
| 946 | self.assertIs(t._fut_waiter, fut2) # White-box test. |
| 947 | t.cancel() |
| 948 | self.assertTrue(fut2.cancelled()) |
| 949 | test_utils.run_briefly(self.loop) |
| 950 | self.assertIs(t._fut_waiter, fut3) # White-box test. |
| 951 | fut3.set_result(42) |
| 952 | res = self.loop.run_until_complete(t) |
| 953 | self.assertEqual(res, 42) |
| 954 | self.assertFalse(fut3.cancelled()) |
| 955 | self.assertFalse(t.cancelled()) |
| 956 | |
| 957 | def test_cancel_current_task(self): |
| 958 | loop = asyncio.new_event_loop() |
nothing calls this directly
no test coverage detected