summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-12 01:31:40 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-12 01:31:40 (GMT)
commit801c89be5dbf90defc492d9b81d6dec8e8a1a16a (patch)
treeeec66b4bef4b8b21b77895d97d5a33d009af7782 /Lib/test/regrtest.py
parentdcb46eda322f46bb855c3017a7309d1f9bc85023 (diff)
downloadcpython-801c89be5dbf90defc492d9b81d6dec8e8a1a16a.zip
cpython-801c89be5dbf90defc492d9b81d6dec8e8a1a16a.tar.gz
cpython-801c89be5dbf90defc492d9b81d6dec8e8a1a16a.tar.bz2
Add -s/--start option that makes it easier to run the tests in batches
when one test fails and you want to start running from that point onwards.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 6f6436f..07c49ad 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -15,6 +15,7 @@ Command line options:
-g: generate -- write the output file for a test instead of comparing it
-x: exclude -- arguments are tests to *exclude*
-s: single -- run only a single test (see below)
+-S: start -- start running all the tests with the specified one first
-r: random -- randomize test execution order
-f: fromfile -- read names of tests to run from a file (see below)
-l: findleaks -- if GC is available detect tests that leak memory
@@ -48,6 +49,12 @@ file is missing, the first test_*.py file in testdir or on the command
line is used. (actually tempfile.gettempdir() is used instead of
/tmp).
+-S is used to continue running tests after an aborted run. It will
+maintain the order a standard run (ie, this assumes -r is not used).
+This is useful after the tests have prematurely stopped for some external
+reason and you want to start running from where you left off rather
+than starting from the beginning.
+
-f reads the names of tests from the file given as f's argument, one
or more test names per line. Whitespace is ignored. Blank lines and
lines beginning with '#' are ignored. This is especially useful for
@@ -177,7 +184,8 @@ def usage(code, msg=''):
def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
exclude=False, single=False, randomize=False, fromfile=None,
findleaks=False, use_resources=None, trace=False, coverdir='coverage',
- runleaks=False, huntrleaks=False, verbose2=False, debug=False):
+ runleaks=False, huntrleaks=False, verbose2=False, debug=False,
+ start=None):
"""Execute a test suite.
This also parses command-line options and modifies its behavior
@@ -202,13 +210,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
test_support.record_original_stdout(sys.stdout)
try:
- opts, args = getopt.getopt(sys.argv[1:], 'dhvgqxsrf:lu:t:TD:NLR:wM:',
+ opts, args = getopt.getopt(sys.argv[1:], 'dhvgqxsS:rf:lu:t:TD:NLR:wM:',
['help', 'verbose', 'quiet', 'generate',
'exclude', 'single', 'random', 'fromfile',
'findleaks', 'use=', 'threshold=', 'trace',
'coverdir=', 'nocoverdir', 'runleaks',
'huntrleaks=', 'verbose2', 'memlimit=',
- 'debug',
+ 'debug', 'start='
])
except getopt.error as msg:
usage(2, msg)
@@ -232,6 +240,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
generate = True
elif o in ('-x', '--exclude'):
exclude = True
+ elif o in ('-S', '--start'):
+ start = a
elif o in ('-s', '--single'):
single = True
elif o in ('-r', '--randomize'):
@@ -345,6 +355,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)
if randomize:
random.shuffle(tests)
if trace: