]> granicus.if.org Git - python/commitdiff
regrtest: fix test to choose if header should be displayed (#3172)
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 21 Aug 2017 21:57:06 +0000 (23:57 +0200)
committerGitHub <noreply@github.com>
Mon, 21 Aug 2017 21:57:06 +0000 (23:57 +0200)
Check "tests" before its value is replaced.

Lib/test/regrtest.py

index cd8cc1593648a2929028604a332987e1ea30d4da..83434c8802471fa5b258303a9ff72e31c114b63a 100755 (executable)
@@ -572,6 +572,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
             nottests.add(arg)
         args = []
 
+    display_header = (verbose or header or not (quiet or single or tests or args)) and (not pgo)
     alltests = findtests(testdir, stdtests, nottests)
     selected = tests or args or alltests
     if single:
@@ -657,18 +658,17 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
         sys.stdout.flush()
 
     # For a partial run, we do not need to clutter the output.
-    if verbose or header or not (quiet or single or tests or args):
-        if not pgo:
-            # Print basic platform information
-            print "==", platform.python_implementation(), \
-                        " ".join(sys.version.split())
-            print "==  ", platform.platform(aliased=True), \
-                          "%s-endian" % sys.byteorder
-            print "==  ", os.getcwd()
-            ncpu = cpu_count()
-            if ncpu:
-                print "== CPU count:", ncpu
-            print "Testing with flags:", sys.flags
+    if display_header:
+        # Print basic platform information
+        print "==", platform.python_implementation(), \
+                    " ".join(sys.version.split())
+        print "==  ", platform.platform(aliased=True), \
+                      "%s-endian" % sys.byteorder
+        print "==  ", os.getcwd()
+        ncpu = cpu_count()
+        if ncpu:
+            print "== CPU count:", ncpu
+        print "Testing with flags:", sys.flags
 
     if randomize:
         random.seed(random_seed)