Code

Opened 3 years ago

Closed 3 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

Description

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

Index: django/trunk/django/test/testcases.py
===================================================================
--- a/django/trunk/django/test/testcases.py
+++ b/django/trunk/django/test/testcases.py
@@ -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)

Cheers!

Attachments (1)

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

Download all attachments as: .zip

Change History (5)

Changed 3 years ago by zimnyx

comment:1 Changed 3 years ago by zimnyx

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

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

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

comment:2 Changed 3 years ago by zimnyx

  • Needs tests set

comment:3 Changed 3 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 3 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.