bpo-41322: added deprecation warning for tests returning value!=None (GH-27748)

This commit is contained in:
andrei kulakov 2021-08-19 05:41:04 -04:00 committed by GitHub
parent 0fd66e46b2
commit 3db42fc5ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,6 @@
import asyncio
import inspect
import warnings
from .case import TestCase
@ -62,7 +63,9 @@ class IsolatedAsyncioTestCase(TestCase):
self._callAsync(self.asyncSetUp)
def _callTestMethod(self, method):
self._callMaybeAsync(method)
if self._callMaybeAsync(method) is not None:
warnings.warn(f'It is deprecated to return a value!=None from a '
f'test case ({method})', DeprecationWarning)
def _callTearDown(self):
self._callAsync(self.asyncTearDown)