mirror of https://github.com/python/cpython.git
The output directory for tests that compare against stdout is now gone!
This commit is contained in:
parent
aa5778d1b8
commit
a5573b3153
|
@ -11,7 +11,6 @@
|
||||||
-v: verbose -- run tests in verbose mode with output to stdout
|
-v: verbose -- run tests in verbose mode with output to stdout
|
||||||
-w: verbose2 -- re-run failed tests in verbose mode
|
-w: verbose2 -- re-run failed tests in verbose mode
|
||||||
-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
|
|
||||||
-x: exclude -- arguments are tests to *exclude*
|
-x: exclude -- arguments are tests to *exclude*
|
||||||
-s: single -- run only a single test (see below)
|
-s: single -- run only a single test (see below)
|
||||||
-r: random -- randomize test execution order
|
-r: random -- randomize test execution order
|
||||||
|
@ -206,8 +205,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
test_support.record_original_stdout(sys.stdout)
|
test_support.record_original_stdout(sys.stdout)
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:',
|
opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:',
|
||||||
['help', 'verbose', 'quiet', 'generate',
|
['help', 'verbose', 'quiet', 'exclude',
|
||||||
'exclude', 'single', 'random', 'fromfile',
|
'single', 'random', 'fromfile',
|
||||||
'findleaks', 'use=', 'threshold=', 'trace',
|
'findleaks', 'use=', 'threshold=', 'trace',
|
||||||
'coverdir=', 'nocoverdir', 'runleaks',
|
'coverdir=', 'nocoverdir', 'runleaks',
|
||||||
'huntrleaks=', 'verbose2', 'memlimit=',
|
'huntrleaks=', 'verbose2', 'memlimit=',
|
||||||
|
@ -228,8 +227,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
elif o in ('-q', '--quiet'):
|
elif o in ('-q', '--quiet'):
|
||||||
quiet = True;
|
quiet = True;
|
||||||
verbose = 0
|
verbose = 0
|
||||||
elif o in ('-g', '--generate'):
|
|
||||||
generate = True
|
|
||||||
elif o in ('-x', '--exclude'):
|
elif o in ('-x', '--exclude'):
|
||||||
exclude = True
|
exclude = True
|
||||||
elif o in ('-s', '--single'):
|
elif o in ('-s', '--single'):
|
||||||
|
@ -285,8 +282,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
use_resources.remove(r)
|
use_resources.remove(r)
|
||||||
elif r not in use_resources:
|
elif r not in use_resources:
|
||||||
use_resources.append(r)
|
use_resources.append(r)
|
||||||
if generate and verbose:
|
|
||||||
usage(2, "-g and -v don't go together!")
|
|
||||||
if single and fromfile:
|
if single and fromfile:
|
||||||
usage(2, "-s and -f don't go together!")
|
usage(2, "-s and -f don't go together!")
|
||||||
|
|
||||||
|
@ -404,9 +399,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
if not bad and not skipped and len(good) > 1:
|
if not bad and not skipped and len(good) > 1:
|
||||||
print "All",
|
print "All",
|
||||||
print count(len(good), "test"), "OK."
|
print count(len(good), "test"), "OK."
|
||||||
if verbose:
|
|
||||||
print "CAUTION: stdout isn't compared in verbose mode:"
|
|
||||||
print "a test that passes in verbose mode may fail without it."
|
|
||||||
if bad:
|
if bad:
|
||||||
print count(len(bad), "test"), "failed:"
|
print count(len(bad), "test"), "failed:"
|
||||||
printlist(bad)
|
printlist(bad)
|
||||||
|
@ -504,8 +496,6 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
|
||||||
"""Run a single test.
|
"""Run a single test.
|
||||||
|
|
||||||
test -- the name of the test
|
test -- the name of the test
|
||||||
generate -- if true, generate output, instead of running the test
|
|
||||||
and comparing it to a previously created output file
|
|
||||||
verbose -- if true, print more messages
|
verbose -- if true, print more messages
|
||||||
quiet -- if true, don't print 'skipped' messages (probably redundant)
|
quiet -- if true, don't print 'skipped' messages (probably redundant)
|
||||||
testdir -- test directory
|
testdir -- test directory
|
||||||
|
@ -529,8 +519,6 @@ def runtest_inner(test, generate, verbose, quiet,
|
||||||
test_support.unload(test)
|
test_support.unload(test)
|
||||||
if not testdir:
|
if not testdir:
|
||||||
testdir = findtestdir()
|
testdir = findtestdir()
|
||||||
outputdir = os.path.join(testdir, "output")
|
|
||||||
outputfile = os.path.join(outputdir, test)
|
|
||||||
if verbose:
|
if verbose:
|
||||||
cfp = None
|
cfp = None
|
||||||
else:
|
else:
|
||||||
|
@ -587,26 +575,6 @@ def runtest_inner(test, generate, verbose, quiet,
|
||||||
if not cfp:
|
if not cfp:
|
||||||
return 1
|
return 1
|
||||||
output = cfp.getvalue()
|
output = cfp.getvalue()
|
||||||
if generate:
|
|
||||||
if output == test + "\n":
|
|
||||||
if os.path.exists(outputfile):
|
|
||||||
# Write it since it already exists (and the contents
|
|
||||||
# may have changed), but let the user know it isn't
|
|
||||||
# needed:
|
|
||||||
print "output file", outputfile, \
|
|
||||||
"is no longer needed; consider removing it"
|
|
||||||
else:
|
|
||||||
# We don't need it, so don't create it.
|
|
||||||
return 1
|
|
||||||
fp = open(outputfile, "w")
|
|
||||||
fp.write(output)
|
|
||||||
fp.close()
|
|
||||||
return 1
|
|
||||||
if os.path.exists(outputfile):
|
|
||||||
fp = open(outputfile, "r")
|
|
||||||
expected = fp.read()
|
|
||||||
fp.close()
|
|
||||||
else:
|
|
||||||
expected = test + "\n"
|
expected = test + "\n"
|
||||||
if output == expected or huntrleaks:
|
if output == expected or huntrleaks:
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -78,6 +78,8 @@ Library
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Output comparison tests are no longer supported.
|
||||||
|
|
||||||
- Rewrite test_errno to use unittest and no longer be a no-op.
|
- Rewrite test_errno to use unittest and no longer be a no-op.
|
||||||
|
|
||||||
- GHOP 234: Convert test_extcall to doctest.
|
- GHOP 234: Convert test_extcall to doctest.
|
||||||
|
|
Loading…
Reference in New Issue