[Python-checkins] bpo-33718: regrtest keeps filters to re-run fails (GH-7291)

Victor Stinner webhook-mailer at python.org
Thu May 31 18:49:01 EDT 2018


https://github.com/python/cpython/commit/9e24930dfdc28e16dabbfd7dd1ead1336b7b0d6c
commit: 9e24930dfdc28e16dabbfd7dd1ead1336b7b0d6c
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-06-01T00:48:57+02:00
summary:

bpo-33718: regrtest keeps filters to re-run fails (GH-7291)

* No longer clear filters, like --match, to re-run failed tests in
  verbose mode (-w option).
* Tests result: always indicate if tests have been interrupted.
* Enhance tests summary

files:
M Lib/test/libregrtest/main.py

diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 1ab47bf58d67..f0c1631509bd 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -282,7 +282,6 @@ def rerun_failed_tests(self):
         self.ns.verbose = True
         self.ns.failfast = False
         self.ns.verbose3 = False
-        self.ns.match_tests = None
 
         print()
         print("Re-running failed tests in verbose mode")
@@ -313,7 +312,7 @@ def display_result(self):
             return
 
         print()
-        print("== Tests result ==")
+        print("== Tests result: %s ==" % self.get_tests_result())
 
         if self.interrupted:
             print()
@@ -324,11 +323,6 @@ def display_result(self):
             print(count(len(omitted), "test"), "omitted:")
             printlist(omitted)
 
-        if self.rerun:
-            print()
-            print(count(len(self.rerun), "test"), "re-run tests:")
-            printlist(self.rerun)
-
         if self.good and not self.ns.quiet:
             print()
             if (not self.bad
@@ -361,6 +355,11 @@ def display_result(self):
             print(count(len(self.skipped), "test"), "skipped:")
             printlist(self.skipped)
 
+        if self.rerun:
+            print()
+            print("%s:" % count(len(self.rerun), "re-run test"))
+            printlist(self.rerun)
+
     def run_tests_sequential(self):
         if self.ns.trace:
             import trace
@@ -445,6 +444,21 @@ def display_header(self):
               % (locale.getpreferredencoding(False),
                  sys.getfilesystemencoding()))
 
+    def get_tests_result(self):
+        result = []
+        if self.bad:
+            result.append("FAILURE")
+        elif self.ns.fail_env_changed and self.environment_changed:
+            result.append("ENV CHANGED")
+
+        if self.interrupted:
+            result.append("INTERRUPTED")
+
+        if not result:
+            result.append("SUCCESS")
+
+        return ', '.join(result)
+
     def run_tests(self):
         # For a partial run, we do not need to clutter the output.
         if (self.ns.header
@@ -486,16 +500,7 @@ def finalize(self):
         print()
         duration = time.monotonic() - self.start_time
         print("Total duration: %s" % format_duration(duration))
-
-        if self.bad:
-            result = "FAILURE"
-        elif self.interrupted:
-            result = "INTERRUPTED"
-        elif self.ns.fail_env_changed and self.environment_changed:
-            result = "ENV CHANGED"
-        else:
-            result = "SUCCESS"
-        print("Tests result: %s" % result)
+        print("Tests result: %s" % self.get_tests_result())
 
         if self.ns.runleaks:
             os.system("leaks %d" % os.getpid())



More information about the Python-checkins mailing list