@@ -109,11 +109,7 @@ async def coro():
109109 self .assertTrue (hasattr (t , '_cancel_message' ))
110110 self .assertEqual (t ._cancel_message , None )
111111
112- with self .assertWarnsRegex (
113- DeprecationWarning ,
114- "Passing 'msg' argument"
115- ):
116- t .cancel ('my message' )
112+ t .cancel ('my message' )
117113 self .assertEqual (t ._cancel_message , 'my message' )
118114
119115 with self .assertRaises (asyncio .CancelledError ) as cm :
@@ -125,11 +121,7 @@ def test_task_cancel_message_setter(self):
125121 async def coro ():
126122 pass
127123 t = self .new_task (self .loop , coro ())
128- with self .assertWarnsRegex (
129- DeprecationWarning ,
130- "Passing 'msg' argument"
131- ):
132- t .cancel ('my message' )
124+ t .cancel ('my message' )
133125 t ._cancel_message = 'my new message'
134126 self .assertEqual (t ._cancel_message , 'my new message' )
135127
@@ -706,14 +698,7 @@ async def sleep():
706698 async def coro ():
707699 task = self .new_task (loop , sleep ())
708700 await asyncio .sleep (0 )
709- if cancel_args not in ((), (None ,)):
710- with self .assertWarnsRegex (
711- DeprecationWarning ,
712- "Passing 'msg' argument"
713- ):
714- task .cancel (* cancel_args )
715- else :
716- task .cancel (* cancel_args )
701+ task .cancel (* cancel_args )
717702 done , pending = await asyncio .wait ([task ])
718703 task .result ()
719704
@@ -747,14 +732,7 @@ async def sleep():
747732 async def coro ():
748733 task = self .new_task (loop , sleep ())
749734 await asyncio .sleep (0 )
750- if cancel_args not in ((), (None ,)):
751- with self .assertWarnsRegex (
752- DeprecationWarning ,
753- "Passing 'msg' argument"
754- ):
755- task .cancel (* cancel_args )
756- else :
757- task .cancel (* cancel_args )
735+ task .cancel (* cancel_args )
758736 done , pending = await asyncio .wait ([task ])
759737 task .exception ()
760738
@@ -777,17 +755,10 @@ async def sleep():
777755 fut .set_result (None )
778756 await asyncio .sleep (10 )
779757
780- def cancel (task , msg ):
781- with self .assertWarnsRegex (
782- DeprecationWarning ,
783- "Passing 'msg' argument"
784- ):
785- task .cancel (msg )
786-
787758 async def coro ():
788759 inner_task = self .new_task (loop , sleep ())
789760 await fut
790- loop .call_soon (cancel , inner_task , 'msg' )
761+ loop .call_soon (inner_task . cancel , 'msg' )
791762 try :
792763 await inner_task
793764 except asyncio .CancelledError as ex :
@@ -813,11 +784,7 @@ async def sleep():
813784 async def coro ():
814785 task = self .new_task (loop , sleep ())
815786 # We deliberately leave out the sleep here.
816- with self .assertWarnsRegex (
817- DeprecationWarning ,
818- "Passing 'msg' argument"
819- ):
820- task .cancel ('my message' )
787+ task .cancel ('my message' )
821788 done , pending = await asyncio .wait ([task ])
822789 task .exception ()
823790
@@ -2179,14 +2146,7 @@ async def test():
21792146 async def main ():
21802147 qwe = self .new_task (loop , test ())
21812148 await asyncio .sleep (0.2 )
2182- if cancel_args not in ((), (None ,)):
2183- with self .assertWarnsRegex (
2184- DeprecationWarning ,
2185- "Passing 'msg' argument"
2186- ):
2187- qwe .cancel (* cancel_args )
2188- else :
2189- qwe .cancel (* cancel_args )
2149+ qwe .cancel (* cancel_args )
21902150 await qwe
21912151
21922152 try :
0 commit comments