Skip to content

Commit 0fbac70

Browse files
authored
regrtest: fix test to choose if header should be displayed (#3172)
Check "tests" before its value is replaced.
1 parent 02d4292 commit 0fbac70

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Lib/test/regrtest.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
572572
nottests.add(arg)
573573
args = []
574574

575+
display_header = (verbose or header or not (quiet or single or tests or args)) and (not pgo)
575576
alltests = findtests(testdir, stdtests, nottests)
576577
selected = tests or args or alltests
577578
if single:
@@ -657,18 +658,17 @@ def display_progress(test_index, test):
657658
sys.stdout.flush()
658659

659660
# For a partial run, we do not need to clutter the output.
660-
if verbose or header or not (quiet or single or tests or args):
661-
if not pgo:
662-
# Print basic platform information
663-
print "==", platform.python_implementation(), \
664-
" ".join(sys.version.split())
665-
print "== ", platform.platform(aliased=True), \
666-
"%s-endian" % sys.byteorder
667-
print "== ", os.getcwd()
668-
ncpu = cpu_count()
669-
if ncpu:
670-
print "== CPU count:", ncpu
671-
print "Testing with flags:", sys.flags
661+
if display_header:
662+
# Print basic platform information
663+
print "==", platform.python_implementation(), \
664+
" ".join(sys.version.split())
665+
print "== ", platform.platform(aliased=True), \
666+
"%s-endian" % sys.byteorder
667+
print "== ", os.getcwd()
668+
ncpu = cpu_count()
669+
if ncpu:
670+
print "== CPU count:", ncpu
671+
print "Testing with flags:", sys.flags
672672

673673
if randomize:
674674
random.seed(random_seed)

0 commit comments

Comments
 (0)