1818-l: findleaks -- if GC is available detect tests that leak memory
1919-u: use -- specify which special resource intensive tests to run
2020-h: help -- print this text and exit
21+ -t: threshold -- call gc.set_threshold(N)
2122
2223If non-option arguments are present, they are names for tests to run,
2324unless -x is given, in which case they are names for tests not to run.
2425If no test names are given, all tests are run.
2526
2627-v is incompatible with -g and does not compare test output files.
2728
28- -s means to run only a single test and exit. This is useful when doing memory
29- analysis on the Python interpreter (which tend to consume too many resources to
30- run the full regression test non-stop). The file /tmp/pynexttest is read to
31- find the next test to run. If this file is missing, the first test_*.py file
32- in testdir or on the command line is used. (actually tempfile.gettempdir() is
33- used instead of /tmp).
29+ -s means to run only a single test and exit. This is useful when
30+ doing memory analysis on the Python interpreter (which tend to consume
31+ too many resources to run the full regression test non-stop). The
32+ file /tmp/pynexttest is read to find the next test to run. If this
33+ file is missing, the first test_*.py file in testdir or on the command
34+ line is used. (actually tempfile.gettempdir() is used instead of
35+ /tmp).
3436
35- -f reads the names of tests from the file given as f's argument, one or more
36- test names per line. Whitespace is ignored. Blank lines and lines beginning
37- with '#' are ignored. This is especially useful for whittling down failures
38- involving interactions among tests.
37+ -f reads the names of tests from the file given as f's argument, one
38+ or more test names per line. Whitespace is ignored. Blank lines and
39+ lines beginning with '#' are ignored. This is especially useful for
40+ whittling down failures involving interactions among tests.
3941
40- -u is used to specify which special resource intensive tests to run, such as
41- those requiring large file support or network connectivity. The argument is a
42- comma-separated list of words indicating the resources to test. Currently
43- only the following are defined:
42+ -u is used to specify which special resource intensive tests to run,
43+ such as those requiring large file support or network connectivity.
44+ The argument is a comma-separated list of words indicating the
45+ resources to test. Currently only the following are defined:
4446
4547 all - Enable all special resources.
4648
4749 curses - Tests that use curses and will modify the terminal's
4850 state and output modes.
4951
50- largefile - It is okay to run some test that may create huge files. These
51- tests can take a long time and may consume >2GB of disk space
52- temporarily.
52+ largefile - It is okay to run some test that may create huge
53+ files. These tests can take a long time and may
54+ consume >2GB of disk space temporarily.
5355
54- network - It is okay to run tests that use external network resource,
55- e.g. testing SSL support for sockets.
56+ network - It is okay to run tests that use external network
57+ resource, e.g. testing SSL support for sockets.
5658"""
5759
5860import sys
@@ -93,19 +95,19 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
9395 command-line will be used. If that's empty, too, then all *.py
9496 files beginning with test_ will be used.
9597
96- The other default arguments (verbose, quiet, generate, exclude, single,
97- randomize, findleaks, and use_resources) allow programmers calling main()
98- directly to set the values that would normally be set by flags on the
99- command line.
98+ The other default arguments (verbose, quiet, generate, exclude,
99+ single, randomize, findleaks, and use_resources) allow programmers
100+ calling main() directly to set the values that would normally be
101+ set by flags on the command line.
100102
101103 """
102104
103105 test_support .record_original_stdout (sys .stdout )
104106 try :
105- opts , args = getopt .getopt (sys .argv [1 :], 'hvgqxsrf:lu:' ,
107+ opts , args = getopt .getopt (sys .argv [1 :], 'hvgqxsrf:lu:t: ' ,
106108 ['help' , 'verbose' , 'quiet' , 'generate' ,
107109 'exclude' , 'single' , 'random' , 'fromfile' ,
108- 'findleaks' , 'use=' ])
110+ 'findleaks' , 'use=' , 'threshold=' ])
109111 except getopt .error , msg :
110112 usage (2 , msg )
111113
@@ -132,6 +134,9 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
132134 fromfile = a
133135 elif o in ('-l' , '--findleaks' ):
134136 findleaks = 1
137+ elif o in ('-t' , '--threshold' ):
138+ import gc
139+ gc .set_threshold (int (a ))
135140 elif o in ('-u' , '--use' ):
136141 u = [x .lower () for x in a .split (',' )]
137142 for r in u :
0 commit comments