Opened 13 years ago

Closed 13 years ago

#16372 closed Bug (fixed)

TransactionTestCase doesn't count skipped cases in test result.

Reported by: Piotr Czachur Owned by: nobody
Component: Testing framework Version: dev
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 Piotr Czachur 13 years ago.

Download all attachments as: .zip

Change History (5)

by Piotr Czachur, 13 years ago

Attachment: test-result-bugfix.diff added

comment:1 by Piotr Czachur, 13 years ago

Has patch: set

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 by Piotr Czachur, 13 years ago

Needs tests: set

comment:3 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: newclosed

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