Opened 5 years ago

Closed 5 years ago

#16372 closed Bug (fixed)

TransactionTestCase doesn't count skipped cases in test result.

Reported by: zimnyx Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


In r16369 return was added for test cases decorated with unittest.skip:

Index: django/trunk/django/test/
--- a/django/trunk/django/test/
+++ b/django/trunk/django/test/
@@ -283,4 +283,9 @@
         include a call to super().setUp().
+        testMethod = getattr(self, self._testMethodName)
+        if (getattr(self.__class__, "__unittest_skip__", False) or
+            getattr(testMethod, "__unittest_skip__", False)):
+            return

This should solve the problem:

self._addSkip(result, skip_why)


Attachments (1)

test-result-bugfix.diff (844 bytes) - added by zimnyx 5 years ago.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by zimnyx

comment:1 Changed 5 years ago by zimnyx

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I've just attached patch. In fact, for skipped tests is missing three method calls:

  • result.startTest(self)
  • self._addSkip(result, skip_why)
  • result.stopTest(self)

comment:2 Changed 5 years ago by zimnyx

  • Needs tests set

comment:3 Changed 5 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by ramiro

  • Resolution set to fixed
  • Status changed from new to closed

In [16579]:

Fixed #16372 -- Changed strategy implemented in r16369 to fix #14049 to avoid affecting the statistics of test cases ran/skipped kept by unittest. Thanks zimnyx for the report.

Note: See TracTickets for help on using tickets.
Back to Top