@@ -113,11 +113,7 @@ async def coro():
113113 self .assertTrue (hasattr (t , '_cancel_message' ))
114114 self .assertEqual (t ._cancel_message , None )
115115
116- with self .assertWarnsRegex (
117- DeprecationWarning ,
118- "Passing 'msg' argument"
119- ):
120- t .cancel ('my message' )
116+ t .cancel ('my message' )
121117 self .assertEqual (t ._cancel_message , 'my message' )
122118
123119 with self .assertRaises (asyncio .CancelledError ) as cm :
@@ -129,11 +125,7 @@ def test_task_cancel_message_setter(self):
129125 async def coro ():
130126 pass
131127 t = self .new_task (self .loop , coro ())
132- with self .assertWarnsRegex (
133- DeprecationWarning ,
134- "Passing 'msg' argument"
135- ):
136- t .cancel ('my message' )
128+ t .cancel ('my message' )
137129 t ._cancel_message = 'my new message'
138130 self .assertEqual (t ._cancel_message , 'my new message' )
139131
@@ -710,14 +702,7 @@ async def sleep():
710702 async def coro ():
711703 task = self .new_task (loop , sleep ())
712704 await asyncio .sleep (0 )
713- if cancel_args not in ((), (None ,)):
714- with self .assertWarnsRegex (
715- DeprecationWarning ,
716- "Passing 'msg' argument"
717- ):
718- task .cancel (* cancel_args )
719- else :
720- task .cancel (* cancel_args )
705+ task .cancel (* cancel_args )
721706 done , pending = await asyncio .wait ([task ])
722707 task .result ()
723708
@@ -751,14 +736,7 @@ async def sleep():
751736 async def coro ():
752737 task = self .new_task (loop , sleep ())
753738 await asyncio .sleep (0 )
754- if cancel_args not in ((), (None ,)):
755- with self .assertWarnsRegex (
756- DeprecationWarning ,
757- "Passing 'msg' argument"
758- ):
759- task .cancel (* cancel_args )
760- else :
761- task .cancel (* cancel_args )
739+ task .cancel (* cancel_args )
762740 done , pending = await asyncio .wait ([task ])
763741 task .exception ()
764742
@@ -781,17 +759,10 @@ async def sleep():
781759 fut .set_result (None )
782760 await asyncio .sleep (10 )
783761
784- def cancel (task , msg ):
785- with self .assertWarnsRegex (
786- DeprecationWarning ,
787- "Passing 'msg' argument"
788- ):
789- task .cancel (msg )
790-
791762 async def coro ():
792763 inner_task = self .new_task (loop , sleep ())
793764 await fut
794- loop .call_soon (cancel , inner_task , 'msg' )
765+ loop .call_soon (inner_task . cancel , 'msg' )
795766 try :
796767 await inner_task
797768 except asyncio .CancelledError as ex :
@@ -817,11 +788,7 @@ async def sleep():
817788 async def coro ():
818789 task = self .new_task (loop , sleep ())
819790 # We deliberately leave out the sleep here.
820- with self .assertWarnsRegex (
821- DeprecationWarning ,
822- "Passing 'msg' argument"
823- ):
824- task .cancel ('my message' )
791+ task .cancel ('my message' )
825792 done , pending = await asyncio .wait ([task ])
826793 task .exception ()
827794
@@ -2183,14 +2150,7 @@ async def test():
21832150 async def main ():
21842151 qwe = self .new_task (loop , test ())
21852152 await asyncio .sleep (0.2 )
2186- if cancel_args not in ((), (None ,)):
2187- with self .assertWarnsRegex (
2188- DeprecationWarning ,
2189- "Passing 'msg' argument"
2190- ):
2191- qwe .cancel (* cancel_args )
2192- else :
2193- qwe .cancel (* cancel_args )
2153+ qwe .cancel (* cancel_args )
21942154 await qwe
21952155
21962156 try :
0 commit comments