@@ -109,11 +109,7 @@ async def coro():
109
109
self .assertTrue (hasattr (t , '_cancel_message' ))
110
110
self .assertEqual (t ._cancel_message , None )
111
111
112
- with self .assertWarnsRegex (
113
- DeprecationWarning ,
114
- "Passing 'msg' argument"
115
- ):
116
- t .cancel ('my message' )
112
+ t .cancel ('my message' )
117
113
self .assertEqual (t ._cancel_message , 'my message' )
118
114
119
115
with self .assertRaises (asyncio .CancelledError ) as cm :
@@ -125,11 +121,7 @@ def test_task_cancel_message_setter(self):
125
121
async def coro ():
126
122
pass
127
123
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' )
133
125
t ._cancel_message = 'my new message'
134
126
self .assertEqual (t ._cancel_message , 'my new message' )
135
127
@@ -706,14 +698,7 @@ async def sleep():
706
698
async def coro ():
707
699
task = self .new_task (loop , sleep ())
708
700
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 )
717
702
done , pending = await asyncio .wait ([task ])
718
703
task .result ()
719
704
@@ -747,14 +732,7 @@ async def sleep():
747
732
async def coro ():
748
733
task = self .new_task (loop , sleep ())
749
734
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 )
758
736
done , pending = await asyncio .wait ([task ])
759
737
task .exception ()
760
738
@@ -777,17 +755,10 @@ async def sleep():
777
755
fut .set_result (None )
778
756
await asyncio .sleep (10 )
779
757
780
- def cancel (task , msg ):
781
- with self .assertWarnsRegex (
782
- DeprecationWarning ,
783
- "Passing 'msg' argument"
784
- ):
785
- task .cancel (msg )
786
-
787
758
async def coro ():
788
759
inner_task = self .new_task (loop , sleep ())
789
760
await fut
790
- loop .call_soon (cancel , inner_task , 'msg' )
761
+ loop .call_soon (inner_task . cancel , 'msg' )
791
762
try :
792
763
await inner_task
793
764
except asyncio .CancelledError as ex :
@@ -813,11 +784,7 @@ async def sleep():
813
784
async def coro ():
814
785
task = self .new_task (loop , sleep ())
815
786
# 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' )
821
788
done , pending = await asyncio .wait ([task ])
822
789
task .exception ()
823
790
@@ -2179,14 +2146,7 @@ async def test():
2179
2146
async def main ():
2180
2147
qwe = self .new_task (loop , test ())
2181
2148
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 )
2190
2150
await qwe
2191
2151
2192
2152
try :
0 commit comments