Patchwork [2,of,3,stable] run-tests: fixed the --retest count error

login
register
mail settings
Submitter Anurag Goel
Date June 9, 2014, 7:54 p.m.
Message ID <976ed600c1cb5adffd69.1402343640@ubuntu.ubuntu-domain>
Download mbox | patch
Permalink /patch/4956/
State Changes Requested
Headers show

Comments

Anurag Goel - June 9, 2014, 7:54 p.m.
# HG changeset patch
# User anuraggoel <anurag.dsps@gmail.com>
# Date 1402342388 -19800
#      Tue Jun 10 01:03:08 2014 +0530
# Node ID 976ed600c1cb5adffd690df9c34bbcac66d02f2d
# Parent  d64f282d66fd0a66a8acb6bcb0d34b8b72bffba8
run-tests: fixed the --retest count error

While retesting, only failure tests run and others either skipped or ignored.
Therefore, to nullify the effect we need to add skipped and ignored tests in
total failure tests.
Pierre-Yves David - June 10, 2014, 10:03 p.m.
On 06/09/2014 12:54 PM, Anurag Goel wrote:
> # HG changeset patch
> # User anuraggoel <anurag.dsps@gmail.com>
> # Date 1402342388 -19800
> #      Tue Jun 10 01:03:08 2014 +0530
> # Node ID 976ed600c1cb5adffd690df9c34bbcac66d02f2d
> # Parent  d64f282d66fd0a66a8acb6bcb0d34b8b72bffba8
> run-tests: fixed the --retest count error
>
> While retesting, only failure tests run and others either skipped or ignored.
> Therefore, to nullify the effect we need to add skipped and ignored tests in
> total failure tests.

I fails to understand this description. Can you please rephrase?

> diff -r d64f282d66fd -r 976ed600c1cb tests/run-tests.py
> --- a/tests/run-tests.py	Tue Jun 10 00:35:55 2014 +0530
> +++ b/tests/run-tests.py	Tue Jun 10 01:03:08 2014 +0530
> @@ -1101,7 +1101,8 @@
>           if self.showAll:
>               self.stream.writeln('ignored %s' % reason)
>           else:
> -            self.stream.write('i')
> +            if reason != 'not retesting':
> +                self.stream.write('i')

This seems to be a different change that could go in a different changeset.

>               self.stream.flush()
>
>       def addWarn(self, test, reason):
> @@ -1310,6 +1311,12 @@
>
>           self._runner._checkhglib('Tested')
>
> +        # While retesting only failure tests run whose count stored in
> +        # result.testsRun. Therfore to nullify the effect of calculating total
> +        # test ran, we need to add skipped + ignored count in here.
> +        if self._runner.options.retest:
> +            result.testsRun = result.testsRun + skipped + ignored
> +

Also fails to understand this comment. Please rephrase.

Patch

diff -r d64f282d66fd -r 976ed600c1cb tests/run-tests.py
--- a/tests/run-tests.py	Tue Jun 10 00:35:55 2014 +0530
+++ b/tests/run-tests.py	Tue Jun 10 01:03:08 2014 +0530
@@ -1101,7 +1101,8 @@ 
         if self.showAll:
             self.stream.writeln('ignored %s' % reason)
         else:
-            self.stream.write('i')
+            if reason != 'not retesting':
+                self.stream.write('i')
             self.stream.flush()
 
     def addWarn(self, test, reason):
@@ -1310,6 +1311,12 @@ 
 
         self._runner._checkhglib('Tested')
 
+        # While retesting only failure tests run whose count stored in
+        # result.testsRun. Therfore to nullify the effect of calculating total
+        # test ran, we need to add skipped + 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.'