@@ -113,11 +113,7 @@ async def coro():
113
113
self .assertTrue (hasattr (t , '_cancel_message' ))
114
114
self .assertEqual (t ._cancel_message , None )
115
115
116
- with self .assertWarnsRegex (
117
- DeprecationWarning ,
118
- "Passing 'msg' argument"
119
- ):
120
- t .cancel ('my message' )
116
+ t .cancel ('my message' )
121
117
self .assertEqual (t ._cancel_message , 'my message' )
122
118
123
119
with self .assertRaises (asyncio .CancelledError ) as cm :
@@ -129,11 +125,7 @@ def test_task_cancel_message_setter(self):
129
125
async def coro ():
130
126
pass
131
127
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' )
137
129
t ._cancel_message = 'my new message'
138
130
self .assertEqual (t ._cancel_message , 'my new message' )
139
131
@@ -710,14 +702,7 @@ async def sleep():
710
702
async def coro ():
711
703
task = self .new_task (loop , sleep ())
712
704
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 )
721
706
done , pending = await asyncio .wait ([task ])
722
707
task .result ()
723
708
@@ -751,14 +736,7 @@ async def sleep():
751
736
async def coro ():
752
737
task = self .new_task (loop , sleep ())
753
738
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 )
762
740
done , pending = await asyncio .wait ([task ])
763
741
task .exception ()
764
742
@@ -781,17 +759,10 @@ async def sleep():
781
759
fut .set_result (None )
782
760
await asyncio .sleep (10 )
783
761
784
- def cancel (task , msg ):
785
- with self .assertWarnsRegex (
786
- DeprecationWarning ,
787
- "Passing 'msg' argument"
788
- ):
789
- task .cancel (msg )
790
-
791
762
async def coro ():
792
763
inner_task = self .new_task (loop , sleep ())
793
764
await fut
794
- loop .call_soon (cancel , inner_task , 'msg' )
765
+ loop .call_soon (inner_task . cancel , 'msg' )
795
766
try :
796
767
await inner_task
797
768
except asyncio .CancelledError as ex :
@@ -817,11 +788,7 @@ async def sleep():
817
788
async def coro ():
818
789
task = self .new_task (loop , sleep ())
819
790
# 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' )
825
792
done , pending = await asyncio .wait ([task ])
826
793
task .exception ()
827
794
@@ -2183,14 +2150,7 @@ async def test():
2183
2150
async def main ():
2184
2151
qwe = self .new_task (loop , test ())
2185
2152
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 )
2194
2154
await qwe
2195
2155
2196
2156
try :
0 commit comments