File tree 3 files changed +10
-2
lines changed
3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
import asyncio
2
2
import inspect
3
+ import warnings
3
4
4
5
from .case import TestCase
5
6
@@ -62,7 +63,9 @@ def _callSetUp(self):
62
63
self ._callAsync (self .asyncSetUp )
63
64
64
65
def _callTestMethod (self , method ):
65
- self ._callMaybeAsync (method )
66
+ if self ._callMaybeAsync (method ) is not None :
67
+ warnings .warn (f'It is deprecated to return a value!=None from a '
68
+ f'test case ({ method } )' , DeprecationWarning )
66
69
67
70
def _callTearDown (self ):
68
71
self ._callAsync (self .asyncTearDown )
Original file line number Diff line number Diff line change @@ -546,7 +546,9 @@ def _callSetUp(self):
546
546
self .setUp ()
547
547
548
548
def _callTestMethod (self , method ):
549
- method ()
549
+ if method () is not None :
550
+ warnings .warn (f'It is deprecated to return a value!=None from a '
551
+ f'test case ({ method } )' , DeprecationWarning )
550
552
551
553
def _callTearDown (self ):
552
554
self .tearDown ()
Original file line number Diff line number Diff line change
1
+ Added ``DeprecationWarning `` for tests and async tests that return a
2
+ value!=None (as this may indicate an improperly written test, for example a
3
+ test written as a generator function).
You can’t perform that action at this time.
0 commit comments