Code

Ticket #16372: test-result-bugfix.diff

File test-result-bugfix.diff, 844 bytes (added by zimnyx, 3 years ago)
Line 
1=== tmp/django/test/testcases.py
2==================================================================
3--- tmp/django/test/testcases.py        (revision 4159)
4+++ tmp/django/test/testcases.py        (local)
5@@ -285,6 +285,14 @@
6         testMethod = getattr(self, self._testMethodName)
7         if (getattr(self.__class__, "__unittest_skip__", False) or
8             getattr(testMethod, "__unittest_skip__", False)):
9+            # If the class or method was skipped.
10+            result.startTest(self)
11+            try:
12+                skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
13+                            or getattr(testMethod, '__unittest_skip_why__', ''))
14+                self._addSkip(result, skip_why)
15+            finally:
16+                result.stopTest(self)
17             return
18 
19         self.client = self.client_class()