File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11import asyncio
22import inspect
3+ import warnings
34
45from .case import TestCase
56
@@ -62,7 +63,9 @@ def _callSetUp(self):
6263 self ._callAsync (self .asyncSetUp )
6364
6465 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 )
6669
6770 def _callTearDown (self ):
6871 self ._callAsync (self .asyncTearDown )
Original file line number Diff line number Diff line change @@ -546,7 +546,9 @@ def _callSetUp(self):
546546 self .setUp ()
547547
548548 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 )
550552
551553 def _callTearDown (self ):
552554 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