diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-18 17:44:29 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-18 17:44:29 (GMT) |
commit | 931936ef5b681b3d48e1e604bde73611e4814729 (patch) | |
tree | 26d1a25d762d628b22c340ed4c34deb98245e780 /Lib/test/regrtest.py | |
parent | 799c3004553f6f09105addf7ea46165ef3ffc34b (diff) | |
download | cpython-931936ef5b681b3d48e1e604bde73611e4814729.zip cpython-931936ef5b681b3d48e1e604bde73611e4814729.tar.gz cpython-931936ef5b681b3d48e1e604bde73611e4814729.tar.bz2 |
Fix a bunch of problems from merges.
* Ensure local vars are always initialized
* Re-enable use of the start flag
* Pass the right parameters to runtest
* Remove generation of output files, since those should all be gone now
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 20d3777..d67dd31 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -225,6 +225,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, # Defaults if use_resources is None: use_resources = [] + debug = False + start = None for o, a in opts: if o in ('-h', '--help'): print(__doc__) @@ -375,12 +377,12 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, tests = tests or args or findtests(testdir, stdtests, nottests) if single: tests = tests[:1] - ## Remove all the tests that precede start if it's set. - #if start: - # try: - # del tests[:tests.index(start)] - # except ValueError: - # print("Couldn't find starting test (%s), using all tests" % start) + # Remove all the tests that precede start if it's set. + if start: + try: + del tests[:tests.index(start)] + except ValueError: + print("Couldn't find starting test (%s), using all tests" % start) if randomize: random.shuffle(tests) if trace: @@ -477,8 +479,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, print("Re-running test %r in verbose mode" % test) sys.stdout.flush() try: - test_support.verbose = 1 - ok = runtest(test, generate, 1, quiet, testdir, + test_support.verbose = True + ok = runtest(test, generate, True, quiet, test_times, testdir, huntrleaks, debug) except KeyboardInterrupt: # print a newline separate from the ^C @@ -544,7 +546,7 @@ def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS): return stdtests + tests def runtest(test, generate, verbose, quiet, test_times, - testdir=None, huntrleaks=False): + testdir=None, huntrleaks=False, debug=False): """Run a single test. test -- the name of the test @@ -635,27 +637,6 @@ def runtest_inner(test, generate, verbose, quiet, test_times, if not cfp: return 1 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: return 1 |