Patchwork [06,of,11,FOR-REFERENCE] test-run-tests.t: tests the --retest option

login
register
mail settings
Submitter Anurag Goel
Date June 4, 2014, 9:14 p.m.
Message ID <CAMq1dJLH0y92z8_nZx9gL6QxUZHPi5uhY1a7azMLkEMPs54AVw@mail.gmail.com>
Download mbox | patch
Permalink /patch/4927/
State Accepted
Commit 02cd29156d5d571e161360c783dc5e8d2708be0b
Headers show

Comments

Anurag Goel - June 4, 2014, 9:14 p.m.
Following patch fixed the retesting failure error.

While retesting, only failure tests run and others either skipped, ignored
or passed. Therefore, to nullify the effect we need to add skipped and
ignored tests in total failure tests.

         self.stream.writeln('# Ran %d tests, %d skipped, %d warned, %d
failed.'
Pierre-Yves David - June 4, 2014, 11:58 p.m.
On 06/04/2014 02:14 PM, Anurag Goel wrote:
> Following patch fixed the retesting failure error.
>
> While retesting, only failure tests run and others either skipped, ignored
> or passed. Therefore, to nullify the effect we need to add skipped and
> ignored tests in total failure tests.

Nice. This now needs to be a proper patches with description and sent to 
the list.

You also need to adds some comment in the code about what is happening.

>
> diff -r 9774e39b08da tests/run-tests.py
> --- a/tests/run-tests.py    Wed Jun 04 23:22:27 2014 +0530
> +++ b/tests/run-tests.py    Thu Jun 05 02:39:48 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,9 @@
>
>           self._runner._checkhglib('Tested')
>
> +        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.'
>
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff -r 9774e39b08da tests/run-tests.py
--- a/tests/run-tests.py    Wed Jun 04 23:22:27 2014 +0530
+++ b/tests/run-tests.py    Thu Jun 05 02:39:48 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,9 @@ 

         self._runner._checkhglib('Tested')

+        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.