Patchwork [2,of,2,V2,stable] run-tests: fixes the number of tests ran when '--retest' is enabled

login
register
mail settings
Submitter Anurag Goel
Date June 11, 2014, 10:04 p.m.
Message ID <3308ec584ade85bf7ddb.1402524294@ubuntu.ubuntu-domain>
Download mbox | patch
Permalink /patch/4977/
State Accepted
Commit 2b3b60031b6f209e6273db7e12ab1c74b2f5b568
Headers show

Comments

Anurag Goel - June 11, 2014, 10:04 p.m.
# HG changeset patch
# User anuraggoel <anurag.dsps@gmail.com>
# Date 1402523428 -19800
#      Thu Jun 12 03:20:28 2014 +0530
# Node ID 3308ec584ade85bf7ddb3026c747aee912593038
# Parent  a3f304e4f7715feb4c4215c6e0d5a62ae61e9047
run-tests: fixes the number of tests ran when '--retest' is enabled

This patch fixes a regression recently introduced by a refactoring.

While retesting, that is when '--retest' is enabled, only failure tests run
and others either skipped or ignored.

During retesting, "result.testsRun" holds the count of failure test that has
run. But as while printing output, we have subtracted the skipped and ignored
count from "result.testsRun". Therefore, to make the count remain
the same, we need to add skipped and ignored count before printing.
Pierre-Yves David - June 12, 2014, 6:33 a.m.
On 06/11/2014 03:04 PM, Anurag Goel wrote:
> # HG changeset patch
> # User anuraggoel <anurag.dsps@gmail.com>
> # Date 1402523428 -19800
> #      Thu Jun 12 03:20:28 2014 +0530
> # Node ID 3308ec584ade85bf7ddb3026c747aee912593038
> # Parent  a3f304e4f7715feb4c4215c6e0d5a62ae61e9047
> run-tests: fixes the number of tests ran when '--retest' is enabled

Added some hint about the series introducing the regression and pushed 
the 4 patches you sent a V2 for. (alongside my patches adding tests.

I'm waiting for a V2 of the --interactive fix to queue the last bit

(queued)

Patch

diff -r a3f304e4f771 -r 3308ec584ade tests/run-tests.py
--- a/tests/run-tests.py	Thu Jun 12 02:36:52 2014 +0530
+++ b/tests/run-tests.py	Thu Jun 12 03:20:28 2014 +0530
@@ -1312,6 +1312,14 @@ 
 
         self._runner._checkhglib('Tested')
 
+        # When '--retest' is enabled, only failure tests run. At this point
+        # "result.testsRun" holds the count of failure test that has run. But
+        # as while printing output, we have subtracted the skipped and ignored
+        # count from "result.testsRun". Therefore, to make the count remain
+        # the same, we need to add skipped and ignored count in here.
+        if self._runner.options.retest:
+            result.testsRun = result.testsRun + skipped + ignored
+
         # This differs from unittest's default output in that we don't count
         # skipped and ignored tests as part of the total test count.
         self.stream.writeln('# Ran %d tests, %d skipped, %d warned, %d failed.'