bpo-41620: TestCase.run() now always return a TestResult instance (GH-28030)
Previously it returned None if the test class or method was
decorated with a skipping decorator.
Co-authored-by: Iman Tabrizian <iman.tabrizian@gmail.com>
(cherry picked from commit 7e246a3a7b43762480ee4fe0cfb859e8e997a8c8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index d8522c0..e8d9c05 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -573,7 +573,7 @@ def run(self, result=None):
skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
or getattr(testMethod, '__unittest_skip_why__', ''))
self._addSkip(result, self, skip_why)
- return
+ return result
expecting_failure = (
getattr(self, "__unittest_expecting_failure__", False) or