mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Change default verbosity so that there are only three levels left: -q,
default and -v. In default mode, the name of each test is printed. -v is the same as the old -vv. -q is more quiet than the old default mode; that's fine I think.
This commit is contained in:
parent
6688d35c43
commit
a412220bbf
1 changed files with 15 additions and 12 deletions
|
@ -8,7 +8,7 @@ additional facilities.
|
||||||
|
|
||||||
Command line options:
|
Command line options:
|
||||||
|
|
||||||
-v: verbose -- print the name name of each test as it is being run
|
-v: verbose -- run tests in verbose mode with output to stdout
|
||||||
-q: quiet -- don't print anything except if a test fails
|
-q: quiet -- don't print anything except if a test fails
|
||||||
-g: generate -- write the output file for a test instead of comparing it
|
-g: generate -- write the output file for a test instead of comparing it
|
||||||
-x: exclude -- arguments are tests to *exclude*
|
-x: exclude -- arguments are tests to *exclude*
|
||||||
|
@ -17,8 +17,7 @@ If non-option arguments are present, they are names for tests to run,
|
||||||
unless -x is given, in which case they are names for tests not to run.
|
unless -x is given, in which case they are names for tests not to run.
|
||||||
If no test names are given, all tests are run.
|
If no test names are given, all tests are run.
|
||||||
|
|
||||||
If -v is given *twice*, the tests themselves are run in verbose mode.
|
-v is incompatible with -g and does not compare test output files.
|
||||||
This is incompatible with -g and does not compare test output files.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -42,24 +41,28 @@ def main():
|
||||||
exclude = 0
|
exclude = 0
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
if o == '-v': verbose = verbose+1
|
if o == '-v': verbose = verbose+1
|
||||||
if o == '-q': quiet = 1
|
if o == '-q': quiet = 1; verbose = 0
|
||||||
if o == '-g': generate = 1
|
if o == '-g': generate = 1
|
||||||
if o == '-x': exclude = 1
|
if o == '-x': exclude = 1
|
||||||
if generate and verbose>1:
|
if generate and verbose:
|
||||||
print "-g and more than one -v don't go together!"
|
print "-g and -v don't go together!"
|
||||||
return 2
|
return 2
|
||||||
good = []
|
good = []
|
||||||
bad = []
|
bad = []
|
||||||
skipped = []
|
skipped = []
|
||||||
|
for i in range(len(args)):
|
||||||
|
# Strip trailing ".py" from arguments
|
||||||
|
if args[i][-3:] == '.py':
|
||||||
|
args[i] = args[i][:-3]
|
||||||
if exclude:
|
if exclude:
|
||||||
nottests[:0] = args
|
nottests[:0] = args
|
||||||
args = []
|
args = []
|
||||||
tests = args or findtests()
|
tests = args or findtests()
|
||||||
test_support.verbose = verbose>1 # Tell tests to be moderately quiet
|
test_support.verbose = verbose # Tell tests to be moderately quiet
|
||||||
for test in tests:
|
for test in tests:
|
||||||
if verbose:
|
if not quiet:
|
||||||
print test
|
print test
|
||||||
ok = runtest(test, generate, verbose>1)
|
ok = runtest(test, generate, verbose)
|
||||||
if ok > 0:
|
if ok > 0:
|
||||||
good.append(test)
|
good.append(test)
|
||||||
elif ok == 0:
|
elif ok == 0:
|
||||||
|
@ -109,7 +112,7 @@ def findtests():
|
||||||
tests.sort()
|
tests.sort()
|
||||||
return stdtests + tests
|
return stdtests + tests
|
||||||
|
|
||||||
def runtest(test, generate, verbose2):
|
def runtest(test, generate, verbose):
|
||||||
test_support.unload(test)
|
test_support.unload(test)
|
||||||
testdir = findtestdir()
|
testdir = findtestdir()
|
||||||
outputdir = os.path.join(testdir, "output")
|
outputdir = os.path.join(testdir, "output")
|
||||||
|
@ -117,7 +120,7 @@ def runtest(test, generate, verbose2):
|
||||||
try:
|
try:
|
||||||
if generate:
|
if generate:
|
||||||
cfp = open(outputfile, "w")
|
cfp = open(outputfile, "w")
|
||||||
elif verbose2:
|
elif verbose:
|
||||||
cfp = sys.stdout
|
cfp = sys.stdout
|
||||||
else:
|
else:
|
||||||
cfp = Compare(outputfile)
|
cfp = Compare(outputfile)
|
||||||
|
@ -140,7 +143,7 @@ def runtest(test, generate, verbose2):
|
||||||
return 0
|
return 0
|
||||||
except:
|
except:
|
||||||
print "test", test, "crashed --", sys.exc_type, ":", sys.exc_value
|
print "test", test, "crashed --", sys.exc_type, ":", sys.exc_value
|
||||||
if verbose2:
|
if verbose:
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue