annotate Lib/test/regrtest.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents 78e7d2d4b26d
children b7a0e03bb987
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 #! /usr/bin/env python
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
3 """
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
4 Usage:
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
5
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
6 python -m test.regrtest [options] [test_name1 [test_name2 ...]]
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
7 python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
8
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
9
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
10 If no arguments or options are provided, finds all files matching
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
11 the pattern "test_*" in the Lib/test subdirectory and runs
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
12 them in alphabetical order (but see -M and -u, below, for exceptions).
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
13
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
14 For more rigorous testing, it is useful to use the following
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
15 command line:
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
16
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
17 python -E -tt -Wd -3 -m test.regrtest [options] [test_name1 ...]
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
19
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
20 Options:
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
21
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
22 -h/--help -- print this text and exit
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
23
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
24 Verbosity
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
25
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
26 -v/--verbose -- run tests in verbose mode with output to stdout
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
27 -w/--verbose2 -- re-run failed tests in verbose mode
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
28 -W/--verbose3 -- re-run failed tests in verbose mode immediately
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
29 -q/--quiet -- no output unless one or more tests fail
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
30 -S/--slow -- print the slowest 10 tests
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
31 --header -- print header with interpreter info
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
32
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
33 Selecting tests
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
34
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
35 -r/--random -- randomize test execution order (see below)
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
36 --randseed -- pass a random seed to reproduce a previous random run
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
37 -f/--fromfile -- read names of tests to run from a file (see below)
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
38 -x/--exclude -- arguments are tests to *exclude*
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
39 -s/--single -- single step through a set of tests (see below)
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
40 -u/--use RES1,RES2,...
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
41 -- specify which special resource intensive tests to run
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
42 -M/--memlimit LIMIT
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
43 -- run very large memory-consuming tests
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
44
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
45 Special runs
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
47 -l/--findleaks -- if GC is available detect tests that leak memory
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
48 -L/--runleaks -- run the leaks(1) command just before exit
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
49 -R/--huntrleaks RUNCOUNTS
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
50 -- search for reference leaks (needs debug build, v. slow)
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
51 -j/--multiprocess PROCESSES
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
52 -- run PROCESSES processes at once
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
53 -T/--coverage -- turn on code coverage tracing using the trace module
56897
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
54 -D/--coverdir DIRECTORY
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
55 -- Directory where coverage files are put
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
56 -N/--nocoverdir -- Put coverage files alongside modules
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
57 -t/--threshold THRESHOLD
185204d541fe Reformat the regrtest command-line option help and group the options into sections.
Georg Brandl <georg@python.org>
parents: 56896
diff changeset
58 -- call gc.set_threshold(THRESHOLD)
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
59 -F/--forever -- run the specified tests in a loop, until an error happens
5175
197e3206e3f3 Add "extra-verbose" mode, triggered by specifying two -v flags. In
Guido van Rossum <guido@python.org>
parents: 4794
diff changeset
60
33982
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
61
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
62 Additional Option Details:
5175
197e3206e3f3 Add "extra-verbose" mode, triggered by specifying two -v flags. In
Guido van Rossum <guido@python.org>
parents: 4794
diff changeset
63
52398
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
64 -r randomizes test execution order. You can use --randseed=int to provide a
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
65 int seed value for the randomizer; this is useful for reproducing troublesome
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
66 test orders.
33982
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
67
60981
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
68 -s On the first invocation of regrtest using -s, the first test file found
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
69 or the first test file given on the command line is run, and the name of
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
70 the next test is recorded in a file named pynexttest. If run from the
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
71 Python build directory, pynexttest is located in the 'build' subdirectory,
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
72 otherwise it is located in tempfile.gettempdir(). On subsequent runs,
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
73 the test in pynexttest is run, and the next test is written to pynexttest.
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
74 When the last test has been run, pynexttest is deleted. In this way it
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
75 is possible to single step through the test files. This is useful when
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
76 doing memory analysis on the Python interpreter, which process tends to
d63bb35de2f0 Issue 8325: Improve regrtest --help text.
R. David Murray <rdmurray@bitdance.com>
parents: 60895
diff changeset
77 consume too many resources to run the full regression test non-stop.
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
78
23733
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
79 -f reads the names of tests from the file given as f's argument, one
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
80 or more test names per line. Whitespace is ignored. Blank lines and
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
81 lines beginning with '#' are ignored. This is especially useful for
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
82 whittling down failures involving interactions among tests.
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
83
32273
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
84 -L causes the leaks(1) command to be run just before exit if it exists.
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
85 leaks(1) is available on Mac OS X and presumably on some other
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
86 FreeBSD-derived systems.
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
87
32924
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
88 -R runs each test several times and examines sys.gettotalrefcount() to
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
89 see if the test appears to be leaking references. The argument should
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
90 be of the form stab:run:fname where 'stab' is the number of times the
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
91 test is run to let gettotalrefcount settle down, 'run' is the number
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
92 of times further it is run and 'fname' is the name of the file the
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
93 reports are written to. These parameters all have defaults (5, 4 and
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
94 "reflog.txt" respectively), and the minimal invocation is '-R :'.
32924
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
95
37992
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
96 -M runs tests that require an exorbitant amount of memory. These tests
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
97 typically try to ascertain containers keep working when containing more than
39417
74d23cd04421 Concatenation on a long string breaks (SF #1526585).
Armin Rigo <arigo@tunes.org>
parents: 38902
diff changeset
98 2 billion objects, which only works on 64-bit systems. There are also some
74d23cd04421 Concatenation on a long string breaks (SF #1526585).
Armin Rigo <arigo@tunes.org>
parents: 38902
diff changeset
99 tests that try to exhaust the address space of the process, which only makes
74d23cd04421 Concatenation on a long string breaks (SF #1526585).
Armin Rigo <arigo@tunes.org>
parents: 38902
diff changeset
100 sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit,
37992
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
101 which is a string in the form of '2.5Gb', determines howmuch memory the
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
102 tests will limit themselves to (but they may go slightly over.) The number
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
103 shouldn't be more memory than the machine has (including swap memory). You
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
104 should also keep in mind that swap memory is generally much, much slower
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
105 than RAM, and setting memlimit to all available RAM or higher will heavily
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
106 tax the machine. On the other hand, it is no use running these tests with a
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
107 limit of less than 2.5Gb, and many require more than 20Gb. Tests that expect
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
108 to use more than memlimit memory will be skipped. The big-memory tests
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
109 generally run very, very long.
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
110
23733
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
111 -u is used to specify which special resource intensive tests to run,
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
112 such as those requiring large file support or network connectivity.
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
113 The argument is a comma-separated list of words indicating the
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
114 resources to test. Currently only the following are defined:
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
115
22951
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
116 all - Enable all special resources.
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
117
28277
1028dc6807a5 Add 'audio' resource.
Guido van Rossum <guido@python.org>
parents: 28225
diff changeset
118 audio - Tests that use the audio device. (There are known
1028dc6807a5 Add 'audio' resource.
Guido van Rossum <guido@python.org>
parents: 28225
diff changeset
119 cases of broken audio drivers that can crash Python or
1028dc6807a5 Add 'audio' resource.
Guido van Rossum <guido@python.org>
parents: 28225
diff changeset
120 even the Linux kernel.)
1028dc6807a5 Add 'audio' resource.
Guido van Rossum <guido@python.org>
parents: 28225
diff changeset
121
20610
7dcc8a28133a Patch #473187: Add a test script that exercises most of the functions in
Andrew M. Kuchling <amk@amk.ca>
parents: 20547
diff changeset
122 curses - Tests that use curses and will modify the terminal's
7dcc8a28133a Patch #473187: Add a test script that exercises most of the functions in
Andrew M. Kuchling <amk@amk.ca>
parents: 20547
diff changeset
123 state and output modes.
20765
3a07bd2b0386 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 20654
diff changeset
124
23733
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
125 largefile - It is okay to run some test that may create huge
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
126 files. These tests can take a long time and may
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
127 consume >2GB of disk space temporarily.
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
128
23733
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
129 network - It is okay to run tests that use external network
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
130 resource, e.g. testing SSL support for sockets.
26288
b0b608598170 Importing test suite from bsddb3 3.4.0 (with modifications).
Martin v. Löwis <martin@v.loewis.de>
parents: 25825
diff changeset
131
b0b608598170 Importing test suite from bsddb3 3.4.0 (with modifications).
Martin v. Löwis <martin@v.loewis.de>
parents: 25825
diff changeset
132 bsddb - It is okay to run the bsddb testsuite, which takes
b0b608598170 Importing test suite from bsddb3 3.4.0 (with modifications).
Martin v. Löwis <martin@v.loewis.de>
parents: 25825
diff changeset
133 a long time to complete.
26429
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
134
32451
d2c1c7ae7cf4 Move Decimal from the sandbox into production.
Raymond Hettinger <python@rcn.com>
parents: 32273
diff changeset
135 decimal - Test the decimal module against a large suite that
d2c1c7ae7cf4 Move Decimal from the sandbox into production.
Raymond Hettinger <python@rcn.com>
parents: 32273
diff changeset
136 verifies compliance with standards.
d2c1c7ae7cf4 Move Decimal from the sandbox into production.
Raymond Hettinger <python@rcn.com>
parents: 32273
diff changeset
137
65318
07b6bb76ee43 Merged revisions 85482 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65305
diff changeset
138 cpu - Used for certain CPU-heavy tests.
33022
2c93fceee42d Add a trivial test for the compiler package, guarded by compiler resource.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 32948
diff changeset
139
35003
52fed2d0641a whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 34674
diff changeset
140 subprocess Run all tests for the subprocess module.
34674
7a1a8ec6dc53 Only run extensive subprocess tests if -usubprocess to regrtest is specified. Fixes #1124637
Peter Astrand <astrand@lysator.liu.se>
parents: 33986
diff changeset
141
35998
96d1fa36964d Patch #1276356: Implement new resource "urlfetch" for regrtest.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 35942
diff changeset
142 urlfetch - It is okay to download files required on testing.
96d1fa36964d Patch #1276356: Implement new resource "urlfetch" for regrtest.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 35942
diff changeset
143
51140
0a8a7c457f1b Issue #5083: New 'gui' resource for regrtest.
Guilherme Polo <ggpolo@gmail.com>
parents: 51138
diff changeset
144 gui - Run tests that require a running GUI.
0a8a7c457f1b Issue #5083: New 'gui' resource for regrtest.
Guilherme Polo <ggpolo@gmail.com>
parents: 51138
diff changeset
145
53000
9a7317ce6db9 Issue 5665: add more pickling tests.
Collin Winter <collinw@gmail.com>
parents: 52574
diff changeset
146 xpickle - Test pickle and cPickle against Python 2.4, 2.5 and 2.6 to
9a7317ce6db9 Issue 5665: add more pickling tests.
Collin Winter <collinw@gmail.com>
parents: 52574
diff changeset
147 test backwards compatibility. These tests take a long time
9a7317ce6db9 Issue 5665: add more pickling tests.
Collin Winter <collinw@gmail.com>
parents: 52574
diff changeset
148 to run.
9a7317ce6db9 Issue 5665: add more pickling tests.
Collin Winter <collinw@gmail.com>
parents: 52574
diff changeset
149
26429
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
150 To enable all resources except one, use '-uall,-<resource>'. For
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
151 example, to run all the tests except for the bsddb tests, give the
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
152 option '-uall,-bsddb'.
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
153 """
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
154
60453
2e8d2d7c43c0 Switch regrtest to use StringIO instead of cStringIO for test_multiprocessing on Windows. Issue 8333.
Michael Foord <fuzzyman@voidspace.org.uk>
parents: 60077
diff changeset
155 import StringIO
45840
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
156 import getopt
58198
0dd1aa33265f Reverting the Revision: 77368. I committed Flox's big patch for tests by
Senthil Kumaran <orsenthil@gmail.com>
parents: 58197
diff changeset
157 import json
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
158 import os
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
159 import random
45840
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
160 import re
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
161 import sys
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
162 import time
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
163 import traceback
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
164 import warnings
52353
e6009b9cd908 remove test_support.TestSkipped and just use unittest.SkipTest
Benjamin Peterson <benjamin@python.org>
parents: 51487
diff changeset
165 import unittest
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
166 import tempfile
63556
dba99828d91c Merged revisions 77942,79023 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents: 61013
diff changeset
167 import imp
59394
966eb1b9e9db Print platform information to stdout, to help troubleshooting platform-specific failures.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59393
diff changeset
168 import platform
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
169 import sysconfig
24771
1824983fd94a Suppress warnings about test_grammar.py that can't be suppressed inside
Guido van Rossum <guido@python.org>
parents: 24442
diff changeset
170
1824983fd94a Suppress warnings about test_grammar.py that can't be suppressed inside
Guido van Rossum <guido@python.org>
parents: 24442
diff changeset
171
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
172 # Some times __path__ and __file__ are not absolute (e.g. while running from
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
173 # Lib/) and, if we change the CWD to run the tests in a temporary dir, some
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
174 # imports might fail. This affects only the modules imported before os.chdir().
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
175 # These modules are searched first in sys.path[0] (so '' -- the CWD) and if
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
176 # they are found in the CWD their __file__ and __path__ will be relative (this
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
177 # happens before the chdir). All the modules imported after the chdir, are
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
178 # not found in the CWD, and since the other paths in sys.path[1:] are absolute
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
179 # (site.py absolutize them), the __file__ and __path__ will be absolute too.
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
180 # Therefore it is necessary to absolutize manually the __file__ and __path__ of
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
181 # the packages to prevent later imports to fail when the CWD is different.
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
182 for module in sys.modules.itervalues():
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
183 if hasattr(module, '__path__'):
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
184 module.__path__ = [os.path.abspath(path) for path in module.__path__]
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
185 if hasattr(module, '__file__'):
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
186 module.__file__ = os.path.abspath(module.__file__)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
187
38018
b5e7d5b3c442 - Add new Warning class, ImportWarning
Thomas Wouters <thomas@python.org>
parents: 37992
diff changeset
188
26492
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
189 # MacOSX (a.k.a. Darwin) has a default stack size that is too small
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
190 # for deeply recursive regular expressions. We see this as crashes in
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
191 # the Python test suite when running test_re.py and test_sre.py. The
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
192 # fix is to set the stack limit to 2048.
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
193 # This approach may also be useful for other Unixy platforms that
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
194 # suffer from small default stack limits.
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
195 if sys.platform == 'darwin':
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
196 try:
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
197 import resource
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
198 except ImportError:
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
199 pass
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
200 else:
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
201 soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
202 newsoft = min(hard, max(soft, 1024*2048))
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
203 resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
238cac97d165 On Max OSX, try increasing the stack limit to 2048 so test_re and
Guido van Rossum <guido@python.org>
parents: 26429
diff changeset
204
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
205 # Test result constants.
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
206 PASSED = 1
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
207 FAILED = 0
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
208 ENV_CHANGED = -1
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
209 SKIPPED = -2
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
210 RESOURCE_DENIED = -3
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
211 INTERRUPTED = -4
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
212
24364
aa0d2d51fbde Get rid of relative imports in all unittests. Now anything that
Barry Warsaw <barry@python.org>
parents: 24277
diff changeset
213 from test import test_support
22951
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
214
48017
9576bb71a01b now that test_lib2to3 actually works and isn't extremely slow, we don't need the lib2to3 resource
Benjamin Peterson <benjamin@python.org>
parents: 47894
diff changeset
215 RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb',
65318
07b6bb76ee43 Merged revisions 85482 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65305
diff changeset
216 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui',
53000
9a7317ce6db9 Issue 5665: add more pickling tests.
Collin Winter <collinw@gmail.com>
parents: 52574
diff changeset
217 'xpickle')
22951
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
218
60895
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
219 TEMPDIR = os.path.abspath(tempfile.gettempdir())
22951
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
220
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
221
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
222 def usage(code, msg=''):
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
223 print __doc__
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
224 if msg: print msg
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
225 sys.exit(code)
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
226
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
227
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
228 def main(tests=None, testdir=None, verbose=0, quiet=False,
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
229 exclude=False, single=False, randomize=False, fromfile=None,
33982
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
230 findleaks=False, use_resources=None, trace=False, coverdir='coverage',
52398
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
231 runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
232 random_seed=None, use_mp=None, verbose3=False, forever=False,
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
233 header=False):
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
234 """Execute a test suite.
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
235
13620
5b727ab37092 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
Thomas Wouters <thomas@python.org>
parents: 13535
diff changeset
236 This also parses command-line options and modifies its behavior
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 15199
diff changeset
237 accordingly.
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
238
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
239 tests -- a list of strings containing test names (optional)
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
240 testdir -- the directory in which to look for tests (optional)
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
241
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
242 Users other than the Python test suite will certainly want to
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
243 specify testdir; if it's omitted, the directory containing the
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 15199
diff changeset
244 Python test suite is searched for.
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
245
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
246 If the tests argument is omitted, the tests listed on the
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
247 command-line will be used. If that's empty, too, then all *.py
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
248 files beginning with test_ will be used.
13230
7066be2edc3b * added a randomize flag and corresponding -r command line argument that
Skip Montanaro <skip@pobox.com>
parents: 12585
diff changeset
249
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
250 The other default arguments (verbose, quiet, exclude,
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
251 single, randomize, findleaks, use_resources, trace, coverdir,
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
252 print_slow, and random_seed) allow programmers calling main()
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
253 directly to set the values that would normally be set by flags
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
254 on the command line.
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
255 """
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 15199
diff changeset
256
20091
40d4d1cd6c84 Guido points out that sys.__stdout__ is a bit bucket under IDLE. So keep
Tim Peters <tim.peters@gmail.com>
parents: 20088
diff changeset
257 test_support.record_original_stdout(sys.stdout)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
258 try:
57246
53ee8ecc18a5 Remove 'g' from regrtest getopt argument string, since there's no
R. David Murray <rdmurray@bitdance.com>
parents: 57245
diff changeset
259 opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:j:',
56896
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
260 ['help', 'verbose', 'verbose2', 'verbose3', 'quiet',
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
261 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks',
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
262 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
263 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
264 'multiprocess=', 'slaveargs=', 'forever', 'header'])
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
265 except getopt.error, msg:
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
266 usage(2, msg)
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
267
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
268 # Defaults
52398
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
269 if random_seed is None:
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
270 random_seed = random.randrange(10000000)
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
271 if use_resources is None:
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
272 use_resources = []
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
273 for o, a in opts:
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
274 if o in ('-h', '--help'):
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
275 usage(0)
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
276 elif o in ('-v', '--verbose'):
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
277 verbose += 1
36933
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
278 elif o in ('-w', '--verbose2'):
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
279 verbose2 = True
56896
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
280 elif o in ('-W', '--verbose3'):
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
281 verbose3 = True
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
282 elif o in ('-q', '--quiet'):
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
283 quiet = True;
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
284 verbose = 0
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
285 elif o in ('-x', '--exclude'):
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
286 exclude = True
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
287 elif o in ('-s', '--single'):
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
288 single = True
45840
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
289 elif o in ('-S', '--slow'):
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
290 print_slow = True
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
291 elif o in ('-r', '--randomize'):
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
292 randomize = True
52398
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
293 elif o == '--randseed':
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
294 random_seed = int(a)
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
295 elif o in ('-f', '--fromfile'):
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
296 fromfile = a
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
297 elif o in ('-l', '--findleaks'):
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
298 findleaks = True
32273
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
299 elif o in ('-L', '--runleaks'):
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
300 runleaks = True
23733
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
301 elif o in ('-t', '--threshold'):
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
302 import gc
7eaabe77d5cb Added -t (--threshold) option to call gc.set_threshold(N).
Guido van Rossum <guido@python.org>
parents: 23643
diff changeset
303 gc.set_threshold(int(a))
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
304 elif o in ('-T', '--coverage'):
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
305 trace = True
33982
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
306 elif o in ('-D', '--coverdir'):
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
307 coverdir = os.path.join(os.getcwd(), a)
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
308 elif o in ('-N', '--nocoverdir'):
468a10ebbcd5 Add options to regrtest.py to make it possible to specify where to put
Walter Dörwald <walter@livinglogic.de>
parents: 33374
diff changeset
309 coverdir = None
32924
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
310 elif o in ('-R', '--huntrleaks'):
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
311 huntrleaks = a.split(':')
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
312 if len(huntrleaks) not in (2, 3):
32924
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
313 print a, huntrleaks
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
314 usage(2, '-R takes 2 or 3 colon-separated arguments')
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
315 if not huntrleaks[0]:
32924
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
316 huntrleaks[0] = 5
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
317 else:
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
318 huntrleaks[0] = int(huntrleaks[0])
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
319 if not huntrleaks[1]:
32924
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
320 huntrleaks[1] = 4
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
321 else:
936712b31bed Check in my refleak hunting code.
Michael W. Hudson <mwh@python.net>
parents: 32815
diff changeset
322 huntrleaks[1] = int(huntrleaks[1])
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
323 if len(huntrleaks) == 2 or not huntrleaks[2]:
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
324 huntrleaks[2:] = ["reflog.txt"]
37992
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
325 elif o in ('-M', '--memlimit'):
8dc2a4d8a22e The result of SF patch #1471578: big-memory tests for strings, lists and
Thomas Wouters <thomas@python.org>
parents: 37694
diff changeset
326 test_support.set_memlimit(a)
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
327 elif o in ('-u', '--use'):
19768
d4f53b1fb424 Two small changes to the resource usage option:
Guido van Rossum <guido@python.org>
parents: 19729
diff changeset
328 u = [x.lower() for x in a.split(',')]
d4f53b1fb424 Two small changes to the resource usage option:
Guido van Rossum <guido@python.org>
parents: 19729
diff changeset
329 for r in u:
22951
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
330 if r == 'all':
26429
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
331 use_resources[:] = RESOURCE_NAMES
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
332 continue
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
333 remove = False
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
334 if r[0] == '-':
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
335 remove = True
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
336 r = r[1:]
22951
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
337 if r not in RESOURCE_NAMES:
6a36112a3dce Added the resource name "all" to enable all of the optional resource uses.
Fred Drake <fdrake@acm.org>
parents: 22723
diff changeset
338 usage(1, 'Invalid -u/--use option: ' + a)
26429
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
339 if remove:
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
340 if r in use_resources:
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
341 use_resources.remove(r)
4bee33790940 Add a way to say "use any resource except A". For example, to run
Fred Drake <fdrake@acm.org>
parents: 26392
diff changeset
342 elif r not in use_resources:
23316
133763332767 Fred's recent changes to support "-u all" resulted in subset resource
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 23264
diff changeset
343 use_resources.append(r)
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
344 elif o in ('-F', '--forever'):
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
345 forever = True
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
346 elif o in ('-j', '--multiprocess'):
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
347 use_mp = int(a)
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
348 elif o == '--header':
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
349 header = True
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
350 elif o == '--slaveargs':
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
351 args, kwargs = json.loads(a)
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
352 try:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
353 result = runtest(*args, **kwargs)
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
354 except BaseException, e:
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
355 result = INTERRUPTED, e.__class__.__name__
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
356 print # Force a newline (just in case)
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
357 print json.dumps(result)
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
358 sys.exit(0)
57247
bb4fda22e657 Merged revisions 76276-76277 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 56947
diff changeset
359 else:
57245
1a3d396d1b6f Issue 7324: add a sanity check to regrtest argument parsing to
R. David Murray <rdmurray@bitdance.com>
parents: 57231
diff changeset
360 print >>sys.stderr, ("No handler for option {}. Please "
57247
bb4fda22e657 Merged revisions 76276-76277 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 56947
diff changeset
361 "report this as a bug at http://bugs.python.org.").format(o)
bb4fda22e657 Merged revisions 76276-76277 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 56947
diff changeset
362 sys.exit(1)
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
363 if single and fromfile:
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
364 usage(2, "-s and -f don't go together!")
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
365 if use_mp and trace:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
366 usage(2, "-T and -j don't go together!")
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
367 if use_mp and findleaks:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
368 usage(2, "-l and -j don't go together!")
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
369
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
370 good = []
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
371 bad = []
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
372 skipped = []
27636
974f196abb87 test_support.requires(): Instead of raising TestSkipped, raise a new
Fred Drake <fdrake@acm.org>
parents: 27629
diff changeset
373 resource_denieds = []
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
374 environment_changed = []
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
375 interrupted = False
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
376
14758
a86568f54375 - Replace debugleak flag with findleaks flag. The new SAVEALL GC option is
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14141
diff changeset
377 if findleaks:
13826
c63863abe1aa Added a -l/--leakdebug option which turns on DEBUG_LEAK if the gc
Barry Warsaw <barry@python.org>
parents: 13620
diff changeset
378 try:
c63863abe1aa Added a -l/--leakdebug option which turns on DEBUG_LEAK if the gc
Barry Warsaw <barry@python.org>
parents: 13620
diff changeset
379 import gc
c63863abe1aa Added a -l/--leakdebug option which turns on DEBUG_LEAK if the gc
Barry Warsaw <barry@python.org>
parents: 13620
diff changeset
380 except ImportError:
15199
77ea8fcef24c Make the regrtest.py -l (findleaks) option considerably less obnoxious.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14758
diff changeset
381 print 'No GC available, disabling findleaks.'
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
382 findleaks = False
13826
c63863abe1aa Added a -l/--leakdebug option which turns on DEBUG_LEAK if the gc
Barry Warsaw <barry@python.org>
parents: 13620
diff changeset
383 else:
15199
77ea8fcef24c Make the regrtest.py -l (findleaks) option considerably less obnoxious.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14758
diff changeset
384 # Uncomment the line below to report garbage that is not
77ea8fcef24c Make the regrtest.py -l (findleaks) option considerably less obnoxious.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14758
diff changeset
385 # freeable by reference counting alone. By default only
77ea8fcef24c Make the regrtest.py -l (findleaks) option considerably less obnoxious.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14758
diff changeset
386 # garbage that is not collectable by the GC is reported.
77ea8fcef24c Make the regrtest.py -l (findleaks) option considerably less obnoxious.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14758
diff changeset
387 #gc.set_debug(gc.DEBUG_SAVEALL)
14758
a86568f54375 - Replace debugleak flag with findleaks flag. The new SAVEALL GC option is
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 14141
diff changeset
388 found_garbage = []
13826
c63863abe1aa Added a -l/--leakdebug option which turns on DEBUG_LEAK if the gc
Barry Warsaw <barry@python.org>
parents: 13620
diff changeset
389
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
390 if single:
60895
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
391 filename = os.path.join(TEMPDIR, 'pynexttest')
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
392 try:
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
393 fp = open(filename, 'r')
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
394 next_test = fp.read().strip()
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
395 tests = [next_test]
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
396 fp.close()
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
397 except IOError:
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
398 pass
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
399
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
400 if fromfile:
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
401 tests = []
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
402 fp = open(os.path.join(test_support.SAVEDCWD, fromfile))
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
403 for line in fp:
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
404 guts = line.split() # assuming no test has whitespace in its name
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
405 if guts and not guts[0].startswith('#'):
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
406 tests.extend(guts)
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
407 fp.close()
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
408
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
409 # Strip .py extensions.
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
410 removepy(args)
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
411 removepy(tests)
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
412
9038
24d0a57ae234 There was still something wrong. The original NOTTESTS are replaced
Guido van Rossum <guido@python.org>
parents: 9032
diff changeset
413 stdtests = STDTESTS[:]
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
414 nottests = NOTTESTS.copy()
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
415 if exclude:
9038
24d0a57ae234 There was still something wrong. The original NOTTESTS are replaced
Guido van Rossum <guido@python.org>
parents: 9032
diff changeset
416 for arg in args:
24d0a57ae234 There was still something wrong. The original NOTTESTS are replaced
Guido van Rossum <guido@python.org>
parents: 9032
diff changeset
417 if arg in stdtests:
24d0a57ae234 There was still something wrong. The original NOTTESTS are replaced
Guido van Rossum <guido@python.org>
parents: 9032
diff changeset
418 stdtests.remove(arg)
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
419 nottests.add(arg)
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
420 args = []
59406
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
421
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
422 # For a partial run, we do not need to clutter the output.
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
423 if verbose or header or not (quiet or single or tests or args):
59406
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
424 # Print basic platform information
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
425 print "==", platform.python_implementation(), \
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
426 " ".join(sys.version.split())
61553
ee596da862f8 Add sensible information about the OS X platform to diagnose issue #8423:
Florent Xicluna <florent.xicluna@gmail.com>
parents: 61258
diff changeset
427 print "== ", platform.platform(aliased=True), \
61554
6cbd4bca097a Revert the additional OS X information (r81140). Keep the endianness information.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 61553
diff changeset
428 "%s-endian" % sys.byteorder
59406
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
429 print "== ", os.getcwd()
67322
4094bc13acfc Merged revisions 87704-87705 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 66720
diff changeset
430 print "Testing with flags:", sys.flags
59406
bdf6d768a8cc Do not print the header lines when running a single test.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59400
diff changeset
431
57752
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
432 alltests = findtests(testdir, stdtests, nottests)
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
433 selected = tests or args or alltests
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
434 if single:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
435 selected = selected[:1]
57752
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
436 try:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
437 next_single_test = alltests[alltests.index(selected[0])+1]
57752
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
438 except IndexError:
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
439 next_single_test = None
13230
7066be2edc3b * added a randomize flag and corresponding -r command line argument that
Skip Montanaro <skip@pobox.com>
parents: 12585
diff changeset
440 if randomize:
52398
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
441 random.seed(random_seed)
9134a2091013 Add the ability to control the random seed used by regrtest.py -r.
Collin Winter <collinw@gmail.com>
parents: 52353
diff changeset
442 print "Using random seed", random_seed
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
443 random.shuffle(selected)
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
444 if trace:
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
445 import trace
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
446 tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
447 trace=False, count=True)
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
448
45840
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
449 test_times = []
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
450 test_support.use_resources = use_resources
12444
03b81912835e Patch by Vladimir Marangozov to unload additionally imported modules
Guido van Rossum <guido@python.org>
parents: 9997
diff changeset
451 save_modules = sys.modules.keys()
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
452
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
453 def accumulate_result(test, result):
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
454 ok, test_time = result
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
455 test_times.append((test_time, test))
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
456 if ok == PASSED:
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
457 good.append(test)
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
458 elif ok == FAILED:
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
459 bad.append(test)
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
460 elif ok == ENV_CHANGED:
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
461 bad.append(test)
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
462 environment_changed.append(test)
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
463 elif ok == SKIPPED:
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
464 skipped.append(test)
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
465 elif ok == RESOURCE_DENIED:
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
466 skipped.append(test)
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
467 resource_denieds.append(test)
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
468
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
469 if forever:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
470 def test_forever(tests=list(selected)):
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
471 while True:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
472 for test in tests:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
473 yield test
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
474 if bad:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
475 return
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
476 tests = test_forever()
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
477 else:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
478 tests = iter(selected)
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
479
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
480 if use_mp:
61028
137916543efa Issue #7449, part 2: regrtest.py -j option requires thread support
Victor Stinner <victor.stinner@haypocalc.com>
parents: 60981
diff changeset
481 try:
137916543efa Issue #7449, part 2: regrtest.py -j option requires thread support
Victor Stinner <victor.stinner@haypocalc.com>
parents: 60981
diff changeset
482 from threading import Thread
137916543efa Issue #7449, part 2: regrtest.py -j option requires thread support
Victor Stinner <victor.stinner@haypocalc.com>
parents: 60981
diff changeset
483 except ImportError:
137916543efa Issue #7449, part 2: regrtest.py -j option requires thread support
Victor Stinner <victor.stinner@haypocalc.com>
parents: 60981
diff changeset
484 print "Multiprocess option requires thread support"
137916543efa Issue #7449, part 2: regrtest.py -j option requires thread support
Victor Stinner <victor.stinner@haypocalc.com>
parents: 60981
diff changeset
485 sys.exit(2)
58817
70e115c34f97 Remove unused imports in test modules.
Georg Brandl <georg@python.org>
parents: 58669
diff changeset
486 from Queue import Queue
70e115c34f97 Remove unused imports in test modules.
Georg Brandl <georg@python.org>
parents: 58669
diff changeset
487 from subprocess import Popen, PIPE
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
488 debug_output_pat = re.compile(r"\[\d+ refs\]$")
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
489 output = Queue()
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
490 def tests_and_args():
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
491 for test in tests:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
492 args_tuple = (
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
493 (test, verbose, quiet),
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
494 dict(huntrleaks=huntrleaks, use_resources=use_resources)
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
495 )
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
496 yield (test, args_tuple)
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
497 pending = tests_and_args()
65305
a5eead141cb4 Merged revisions 85469 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64713
diff changeset
498 opt_args = test_support.args_from_interpreter_flags()
a5eead141cb4 Merged revisions 85469 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64713
diff changeset
499 base_cmd = [sys.executable] + opt_args + ['-m', 'test.regrtest']
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
500 def work():
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
501 # A worker thread.
36719
942ae25cb391 Instead of printing the exception when you interrupt a test (Ctrl-C),
Neal Norwitz <nnorwitz@gmail.com>
parents: 35998
diff changeset
502 try:
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
503 while True:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
504 try:
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
505 test, args_tuple = next(pending)
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
506 except StopIteration:
56601
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
507 output.put((None, None, None, None))
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
508 return
54968
1b8a01dc7f45 Backport fix for buglet from py3k
Antoine Pitrou <solipsis@pitrou.net>
parents: 54465
diff changeset
509 # -E is needed by some tests, e.g. test_import
65305
a5eead141cb4 Merged revisions 85469 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64713
diff changeset
510 popen = Popen(base_cmd + ['--slaveargs', json.dumps(args_tuple)],
56601
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
511 stdout=PIPE, stderr=PIPE,
64147
749c22ffa36e Merged revisions 84176 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64057
diff changeset
512 universal_newlines=True,
749c22ffa36e Merged revisions 84176 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64057
diff changeset
513 close_fds=(os.name != 'nt'))
56601
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
514 stdout, stderr = popen.communicate()
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
515 # Strip last refcount output line if it exists, since it
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
516 # comes from the shutdown of the interpreter in the subcommand.
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
517 stderr = debug_output_pat.sub("", stderr)
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
518 stdout, _, result = stdout.strip().rpartition("\n")
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
519 if not result:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
520 output.put((None, None, None, None))
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
521 return
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
522 result = json.loads(result)
56601
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
523 if not quiet:
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
524 stdout = test+'\n'+stdout
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
525 output.put((test, stdout.rstrip(), stderr.rstrip(), result))
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
526 except BaseException:
56601
06999253987b Issue #7151: regrtest would generate a JSON failure if there was output
R. David Murray <rdmurray@bitdance.com>
parents: 56566
diff changeset
527 output.put((None, None, None, None))
36719
942ae25cb391 Instead of printing the exception when you interrupt a test (Ctrl-C),
Neal Norwitz <nnorwitz@gmail.com>
parents: 35998
diff changeset
528 raise
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
529 workers = [Thread(target=work) for i in range(use_mp)]
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
530 for worker in workers:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
531 worker.start()
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
532 finished = 0
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
533 try:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
534 while finished < use_mp:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
535 test, stdout, stderr, result = output.get()
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
536 if test is None:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
537 finished += 1
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
538 continue
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
539 if stdout:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
540 print stdout
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
541 if stderr:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
542 print >>sys.stderr, stderr
77821
78e7d2d4b26d Flush stdout and stderr when running tests in parallel
Antoine Pitrou <solipsis@pitrou.net>
parents: 75460
diff changeset
543 sys.stdout.flush()
78e7d2d4b26d Flush stdout and stderr when running tests in parallel
Antoine Pitrou <solipsis@pitrou.net>
parents: 75460
diff changeset
544 sys.stderr.flush()
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
545 if result[0] == INTERRUPTED:
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
546 assert result[1] == 'KeyboardInterrupt'
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
547 raise KeyboardInterrupt # What else?
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
548 accumulate_result(test, result)
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
549 except KeyboardInterrupt:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
550 interrupted = True
57231
c1c1f28acb05 Issue #7312 (new feature): Add a -F flag to run the selected tests in
R. David Murray <rdmurray@bitdance.com>
parents: 56979
diff changeset
551 pending.close()
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
552 for worker in workers:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
553 worker.join()
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
554 else:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
555 for test in tests:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
556 if not quiet:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
557 print test
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
558 sys.stdout.flush()
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
559 if trace:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
560 # If we're tracing code coverage, then we don't exit with status
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
561 # if on a false return value from main.
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
562 tracer.runctx('runtest(test, verbose, quiet)',
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
563 globals=globals(), locals=vars())
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
564 else:
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
565 try:
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
566 result = runtest(test, verbose, quiet, huntrleaks)
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
567 accumulate_result(test, result)
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
568 if verbose3 and result[0] == FAILED:
56896
9899eca9c857 Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
Georg Brandl <georg@python.org>
parents: 56621
diff changeset
569 print "Re-running test %r in verbose mode" % test
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
570 runtest(test, True, quiet, huntrleaks)
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
571 except KeyboardInterrupt:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
572 interrupted = True
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
573 break
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
574 except:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
575 raise
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
576 if findleaks:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
577 gc.collect()
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
578 if gc.garbage:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
579 print "Warning: test created", len(gc.garbage),
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
580 print "uncollectable object(s)."
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
581 # move the uncollectable objects somewhere so we don't see
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
582 # them again
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
583 found_garbage.extend(gc.garbage)
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
584 del gc.garbage[:]
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
585 # Unload the newly imported modules (best effort finalization)
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
586 for module in sys.modules.keys():
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
587 if module not in save_modules and module.startswith("test."):
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
588 test_support.unload(module)
20497
a9b19db180a2 Make sure the output lists are sorted, even if run with -r.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 20159
diff changeset
589
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
590 if interrupted:
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
591 # print a newline after ^C
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
592 print
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
593 print "Test suite interrupted by signal SIGINT."
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
594 omitted = set(selected) - set(good) - set(bad) - set(skipped)
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
595 print count(len(omitted), "test"), "omitted:"
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
596 printlist(omitted)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
597 if good and not quiet:
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
598 if not bad and not skipped and not interrupted and len(good) > 1:
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
599 print "All",
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
600 print count(len(good), "test"), "OK."
45840
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
601 if print_slow:
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
602 test_times.sort(reverse=True)
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
603 print "10 slowest tests:"
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
604 for time, test in test_times[:10]:
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
605 print "%s: %.1fs" % (test, time)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
606 if bad:
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
607 bad = set(bad) - set(environment_changed)
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
608 if bad:
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
609 print count(len(bad), "test"), "failed:"
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
610 printlist(bad)
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
611 if environment_changed:
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
612 print "{} altered the execution environment:".format(
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
613 count(len(environment_changed), "test"))
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
614 printlist(environment_changed)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
615 if skipped and not quiet:
19193
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
616 print count(len(skipped), "test"), "skipped:"
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
617 printlist(skipped)
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
618
19186
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
619 e = _ExpectedSkips()
19188
bcfe30cd1f0d Move line; reported on python-dev by Mark Favas (thanks!).
Tim Peters <tim.peters@gmail.com>
parents: 19186
diff changeset
620 plat = sys.platform
19186
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
621 if e.isvalid():
30929
54ff68e973ee * Migrate set() and frozenset() from the sandbox.
Raymond Hettinger <python@rcn.com>
parents: 30686
diff changeset
622 surprise = set(skipped) - e.getexpected() - set(resource_denieds)
19186
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
623 if surprise:
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
624 print count(len(surprise), "skip"), \
19193
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
625 "unexpected on", plat + ":"
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
626 printlist(surprise)
19186
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
627 else:
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
628 print "Those skips are all expected on", plat + "."
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
629 else:
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
630 print "Ask someone to teach regrtest.py about which tests are"
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
631 print "expected to get skipped on", plat + "."
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
632
36933
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
633 if verbose2 and bad:
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
634 print "Re-running failed tests in verbose mode"
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
635 for test in bad:
36936
e256b5302b55 When the new -w option (yay! great idea) reruns a
Tim Peters <tim.peters@gmail.com>
parents: 36933
diff changeset
636 print "Re-running test %r in verbose mode" % test
e256b5302b55 When the new -w option (yay! great idea) reruns a
Tim Peters <tim.peters@gmail.com>
parents: 36933
diff changeset
637 sys.stdout.flush()
36933
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
638 try:
45863
ea91914bcb97 Get regrtest working when re-running tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 45840
diff changeset
639 test_support.verbose = True
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
640 ok = runtest(test, True, quiet, huntrleaks)
36933
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
641 except KeyboardInterrupt:
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
642 # print a newline separate from the ^C
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
643 print
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
644 break
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
645 except:
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
646 raise
ebeba7353894 Add regrtest -w option.
Martin v. Löwis <martin@v.loewis.de>
parents: 36719
diff changeset
647
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
648 if single:
57752
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
649 if next_single_test:
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
650 with open(filename, 'w') as fp:
2bd0f3915938 Issue #7396: fix -s, which was broken by the -j enhancement.
R. David Murray <rdmurray@bitdance.com>
parents: 57747
diff changeset
651 fp.write(next_single_test + '\n')
9997
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
652 else:
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
653 os.unlink(filename)
8c6e705b6b97 Added a -s option which is useful for narrowing down memory leaks.
Barry Warsaw <barry@python.org>
parents: 9038
diff changeset
654
31475
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
655 if trace:
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
656 r = tracer.results()
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
657 r.write_results(show_missing=True, summary=True, coverdir=coverdir)
308c193f51e3 Patch #868499, adds -T option for code coverage. The implementation is a
Barry Warsaw <barry@python.org>
parents: 31386
diff changeset
658
32273
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
659 if runleaks:
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
660 os.system("leaks %d" % os.getpid())
95287cddbc1e add -L flag to cause leaks(1) command to run just before exit
Skip Montanaro <skip@pobox.com>
parents: 31475
diff changeset
661
60077
3329c05e6e31 #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60035
diff changeset
662 sys.exit(len(bad) > 0 or interrupted)
19417
0b11f09cf1e4 Removed --have-resources flag in favor of the more granular -u/--use
Barry Warsaw <barry@python.org>
parents: 19408
diff changeset
663
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
664
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
665 STDTESTS = [
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
666 'test_grammar',
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
667 'test_opcodes',
41127
7100c59182ff Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
Collin Winter <collinw@gmail.com>
parents: 41075
diff changeset
668 'test_dict',
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
669 'test_builtin',
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
670 'test_exceptions',
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
671 'test_types',
41075
0bb969f15118 Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
Collin Winter <collinw@gmail.com>
parents: 39455
diff changeset
672 'test_unittest',
0bb969f15118 Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
Collin Winter <collinw@gmail.com>
parents: 39455
diff changeset
673 'test_doctest',
0bb969f15118 Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
Collin Winter <collinw@gmail.com>
parents: 39455
diff changeset
674 'test_doctest2',
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
675 ]
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
676
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
677 NOTTESTS = {
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
678 'test_support',
16839
e1b1e68cbd8c Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16755
diff changeset
679 'test_future1',
e1b1e68cbd8c Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16755
diff changeset
680 'test_future2',
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
681 }
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
682
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
683 def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
684 """Return a list of all applicable test modules."""
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
685 testdir = findtestdir(testdir)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
686 names = os.listdir(testdir)
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
687 tests = []
59400
4c5c5b4668b4 Backport "test.regrtest -R 2:3" syntax from py3k branch, and other minor adjustments.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59394
diff changeset
688 others = set(stdtests) | nottests
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
689 for name in names:
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
690 modname, ext = os.path.splitext(name)
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
691 if modname[:5] == "test_" and ext == ".py" and modname not in others:
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
692 tests.append(modname)
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
693 return stdtests + sorted(tests)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
694
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
695 def runtest(test, verbose, quiet,
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
696 huntrleaks=False, use_resources=None):
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
697 """Run a single test.
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
698
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
699 test -- the name of the test
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
700 verbose -- if true, print more messages
13924
ddf302d69211 Add largefile support for Linux64 and WIn64. Add test_largefile and some minor
Trent Mick <trentm@activestate.com>
parents: 13856
diff changeset
701 quiet -- if true, don't print 'skipped' messages (probably redundant)
45840
d4bbf9b4710f Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45825
diff changeset
702 test_times -- a list of (time, test_name) pairs
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
703 huntrleaks -- run multiple times to test for leaks; requires a debug
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
704 build; a triple corresponding to -R's three arguments
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
705 Returns one of the test result constants:
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
706 INTERRUPTED KeyboardInterrupt when run under -j
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
707 RESOURCE_DENIED test skipped because resource denied
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
708 SKIPPED test skipped for some other reason
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
709 ENV_CHANGED test failed because it changed the execution environment
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
710 FAILED test failed
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
711 PASSED test passed
8803
4d18ebd4cf42 Generalized so it's useful for testing other packages, by Andrew
Guido van Rossum <guido@python.org>
parents: 8117
diff changeset
712 """
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
713
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
714 test_support.verbose = verbose # Tell tests to be moderately quiet
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
715 if use_resources is not None:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
716 test_support.use_resources = use_resources
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
717 try:
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
718 return runtest_inner(test, verbose, quiet, huntrleaks)
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
719 finally:
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
720 cleanup_test_droppings(test, verbose)
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
721
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
722
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
723 # Unit tests are supposed to leave the execution environment unchanged
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
724 # once they complete. But sometimes tests have bugs, especially when
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
725 # tests fail, and the changes to environment go on to mess up other
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
726 # tests. This can cause issues with buildbot stability, since tests
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
727 # are run in random order and so problems may appear to come and go.
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
728 # There are a few things we can save and restore to mitigate this, and
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
729 # the following context manager handles this task.
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
730
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
731 class saved_test_environment:
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
732 """Save bits of the test environment and restore them at block exit.
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
733
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
734 with saved_test_environment(testname, verbose, quiet):
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
735 #stuff
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
736
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
737 Unless quiet is True, a warning is printed to stderr if any of
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
738 the saved items was changed by the test. The attribute 'changed'
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
739 is initially False, but is set to True if a change is detected.
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
740
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
741 If verbose is more than 1, the before and after state of changed
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
742 items is also printed.
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
743 """
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
744
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
745 changed = False
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
746
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
747 def __init__(self, testname, verbose=0, quiet=False):
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
748 self.testname = testname
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
749 self.verbose = verbose
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
750 self.quiet = quiet
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
751
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
752 # To add things to save and restore, add a name XXX to the resources list
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
753 # and add corresponding get_XXX/restore_XXX functions. get_XXX should
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
754 # return the value to be saved and compared against a second call to the
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
755 # get function when test execution completes. restore_XXX should accept
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
756 # the saved value and restore the resource using it. It will be called if
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
757 # and only if a change in the value is detected.
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
758 #
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
759 # Note: XXX will have any '.' replaced with '_' characters when determining
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
760 # the corresponding method names.
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
761
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
762 resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
75460
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
763 'os.environ', 'sys.path', 'asyncore.socket_map',
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
764 'test_support.TESTFN',
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
765 )
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
766
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
767 def get_sys_argv(self):
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
768 return id(sys.argv), sys.argv, sys.argv[:]
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
769 def restore_sys_argv(self, saved_argv):
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
770 sys.argv = saved_argv[1]
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
771 sys.argv[:] = saved_argv[2]
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
772
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
773 def get_cwd(self):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
774 return os.getcwd()
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
775 def restore_cwd(self, saved_cwd):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
776 os.chdir(saved_cwd)
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
777
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
778 def get_sys_stdout(self):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
779 return sys.stdout
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
780 def restore_sys_stdout(self, saved_stdout):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
781 sys.stdout = saved_stdout
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
782
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
783 def get_sys_stderr(self):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
784 return sys.stderr
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
785 def restore_sys_stderr(self, saved_stderr):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
786 sys.stderr = saved_stderr
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
787
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
788 def get_sys_stdin(self):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
789 return sys.stdin
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
790 def restore_sys_stdin(self, saved_stdin):
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
791 sys.stdin = saved_stdin
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
792
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
793 def get_os_environ(self):
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
794 return id(os.environ), os.environ, dict(os.environ)
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
795 def restore_os_environ(self, saved_environ):
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
796 os.environ = saved_environ[1]
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
797 os.environ.clear()
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
798 os.environ.update(saved_environ[2])
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
799
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
800 def get_sys_path(self):
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
801 return id(sys.path), sys.path, sys.path[:]
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
802 def restore_sys_path(self, saved_path):
56566
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
803 sys.path = saved_path[1]
9f053e550c97 Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
Nick Coghlan <ncoghlan@gmail.com>
parents: 56559
diff changeset
804 sys.path[:] = saved_path[2]
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
805
64057
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
806 def get_asyncore_socket_map(self):
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
807 asyncore = sys.modules.get('asyncore')
65812
131e7cc9e416 Merged revisions 85926 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65811
diff changeset
808 # XXX Making a copy keeps objects alive until __exit__ gets called.
131e7cc9e416 Merged revisions 85926 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65811
diff changeset
809 return asyncore and asyncore.socket_map.copy() or {}
64057
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
810 def restore_asyncore_socket_map(self, saved_map):
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
811 asyncore = sys.modules.get('asyncore')
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
812 if asyncore is not None:
65812
131e7cc9e416 Merged revisions 85926 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65811
diff changeset
813 asyncore.close_all(ignore_all=True)
64057
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
814 asyncore.socket_map.update(saved_map)
8cc8ce7c3909 Merged revisions 84086 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 61554
diff changeset
815
75460
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
816 def get_test_support_TESTFN(self):
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
817 if os.path.isfile(test_support.TESTFN):
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
818 result = 'f'
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
819 elif os.path.isdir(test_support.TESTFN):
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
820 result = 'd'
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
821 else:
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
822 result = None
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
823 return result
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
824 def restore_test_support_TESTFN(self, saved_value):
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
825 if saved_value is None:
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
826 if os.path.isfile(test_support.TESTFN):
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
827 os.unlink(test_support.TESTFN)
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
828 elif os.path.isdir(test_support.TESTFN):
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
829 shutil.rmtree(test_support.TESTFN)
1112c2f602b3 Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 73750
diff changeset
830
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
831 def resource_info(self):
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
832 for name in self.resources:
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
833 method_suffix = name.replace('.', '_')
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
834 get_name = 'get_' + method_suffix
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
835 restore_name = 'restore_' + method_suffix
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
836 yield name, getattr(self, get_name), getattr(self, restore_name)
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
837
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
838 def __enter__(self):
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
839 self.saved_values = dict((name, get()) for name, get, restore
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
840 in self.resource_info())
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
841 return self
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
842
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
843 def __exit__(self, exc_type, exc_val, exc_tb):
65812
131e7cc9e416 Merged revisions 85926 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65811
diff changeset
844 saved_values = self.saved_values
131e7cc9e416 Merged revisions 85926 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65811
diff changeset
845 del self.saved_values
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
846 for name, get, restore in self.resource_info():
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
847 current = get()
65812
131e7cc9e416 Merged revisions 85926 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65811
diff changeset
848 original = saved_values.pop(name)
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
849 # Check for changes to the resource's value
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
850 if current != original:
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
851 self.changed = True
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
852 restore(original)
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
853 if not self.quiet:
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
854 print >>sys.stderr, (
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
855 "Warning -- {} was modified by {}".format(
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
856 name, self.testname))
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
857 if self.verbose > 1:
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
858 print >>sys.stderr, (
56559
9c06c7309765 Formatting tweak so that before and after values are vertically aligned
Nick Coghlan <ncoghlan@gmail.com>
parents: 56558
diff changeset
859 " Before: {}\n After: {} ".format(
9c06c7309765 Formatting tweak so that before and after values are vertically aligned
Nick Coghlan <ncoghlan@gmail.com>
parents: 56558
diff changeset
860 original, current))
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
861 # XXX (ncoghlan): for most resources (e.g. sys.path) identity
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
862 # matters at least as much as value. For others (e.g. cwd),
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
863 # identity is irrelevant. Should we add a mechanism to check
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
864 # for substitution in the cases where it matters?
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
865 return False
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
866
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
867
67921
89d52effc30a Merged revisions 86542,87136,87216,87221,87228,87256,87337-87338,87372,87516,87571,88164 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 67322
diff changeset
868 def runtest_inner(test, verbose, quiet, huntrleaks=False):
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
869 test_support.unload(test)
20158
2c8a5a172f47 regrtest's -g option stopped working, during the changes to improve
Tim Peters <tim.peters@gmail.com>
parents: 20091
diff changeset
870 if verbose:
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
871 capture_stdout = None
20022
109def4a5f6e Change the way unexpected output is reported: rather than stopping at
Guido van Rossum <guido@python.org>
parents: 19969
diff changeset
872 else:
60453
2e8d2d7c43c0 Switch regrtest to use StringIO instead of cStringIO for test_multiprocessing on Windows. Issue 8333.
Michael Foord <fuzzyman@voidspace.org.uk>
parents: 60077
diff changeset
873 capture_stdout = StringIO.StringIO()
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
874
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
875 test_time = 0.0
54088
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
876 refleak = False # True if the test leaked references.
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
877 try:
20088
386fb26e0874 Get rid of the increasingly convoluted global tricks w/ sys.stdout, in
Tim Peters <tim.peters@gmail.com>
parents: 20035
diff changeset
878 save_stdout = sys.stdout
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
879 try:
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
880 if capture_stdout:
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
881 sys.stdout = capture_stdout
24442
226ba34bd998 Complete the absolute import patch for the test suite. All relative
Barry Warsaw <barry@python.org>
parents: 24364
diff changeset
882 if test.startswith('test.'):
226ba34bd998 Complete the absolute import patch for the test suite. All relative
Barry Warsaw <barry@python.org>
parents: 24364
diff changeset
883 abstest = test
226ba34bd998 Complete the absolute import patch for the test suite. All relative
Barry Warsaw <barry@python.org>
parents: 24364
diff changeset
884 else:
226ba34bd998 Complete the absolute import patch for the test suite. All relative
Barry Warsaw <barry@python.org>
parents: 24364
diff changeset
885 # Always import it from the test package
226ba34bd998 Complete the absolute import patch for the test suite. All relative
Barry Warsaw <barry@python.org>
parents: 24364
diff changeset
886 abstest = 'test.' + test
56558
5ea6cd2839cc Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
Nick Coghlan <ncoghlan@gmail.com>
parents: 56509
diff changeset
887 with saved_test_environment(test, verbose, quiet) as environment:
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
888 start_time = time.time()
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
889 the_package = __import__(abstest, globals(), locals(), [])
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
890 the_module = getattr(the_package, test)
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
891 # Old tests run to completion simply as a side-effect of
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
892 # being imported. For tests based on unittest or doctest,
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
893 # explicitly invoke their test_main() function (if it exists).
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
894 indirect_test = getattr(the_module, "test_main", None)
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
895 if indirect_test is not None:
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
896 indirect_test()
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
897 if huntrleaks:
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
898 refleak = dash_R(the_module, test, indirect_test,
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
899 huntrleaks)
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
900 test_time = time.time() - start_time
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
901 finally:
20088
386fb26e0874 Get rid of the increasingly convoluted global tricks w/ sys.stdout, in
Tim Peters <tim.peters@gmail.com>
parents: 20035
diff changeset
902 sys.stdout = save_stdout
27636
974f196abb87 test_support.requires(): Instead of raising TestSkipped, raise a new
Fred Drake <fdrake@acm.org>
parents: 27629
diff changeset
903 except test_support.ResourceDenied, msg:
974f196abb87 test_support.requires(): Instead of raising TestSkipped, raise a new
Fred Drake <fdrake@acm.org>
parents: 27629
diff changeset
904 if not quiet:
974f196abb87 test_support.requires(): Instead of raising TestSkipped, raise a new
Fred Drake <fdrake@acm.org>
parents: 27629
diff changeset
905 print test, "skipped --", msg
974f196abb87 test_support.requires(): Instead of raising TestSkipped, raise a new
Fred Drake <fdrake@acm.org>
parents: 27629
diff changeset
906 sys.stdout.flush()
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
907 return RESOURCE_DENIED, test_time
52574
b2adb7ebdb54 Remove the regrtest check that turns any ImportError into a skipped test.
R. David Murray <rdmurray@bitdance.com>
parents: 52468
diff changeset
908 except unittest.SkipTest, msg:
13924
ddf302d69211 Add largefile support for Linux64 and WIn64. Add test_largefile and some minor
Trent Mick <trentm@activestate.com>
parents: 13856
diff changeset
909 if not quiet:
25825
cebee2a9e3cf Remove spurious cruft from the output.
Fred Drake <fdrake@acm.org>
parents: 25674
diff changeset
910 print test, "skipped --", msg
25252
29559e21cd53 Add a bunch of sys.stdout.flush() calls that will hopefully improve
Guido van Rossum <guido@python.org>
parents: 25001
diff changeset
911 sys.stdout.flush()
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
912 return SKIPPED, test_time
14064
c7fe7569e4e1 When a KeyboardInterrupt is caught, just use the "raise" syntax to
Fred Drake <fdrake@acm.org>
parents: 13924
diff changeset
913 except KeyboardInterrupt:
c7fe7569e4e1 When a KeyboardInterrupt is caught, just use the "raise" syntax to
Fred Drake <fdrake@acm.org>
parents: 13924
diff changeset
914 raise
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
915 except test_support.TestFailed, msg:
66720
04cec2e1ca41 Merged revisions 85086 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 65812
diff changeset
916 print >>sys.stderr, "test", test, "failed --", msg
04cec2e1ca41 Merged revisions 85086 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 65812
diff changeset
917 sys.stderr.flush()
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
918 return FAILED, test_time
5800
7e8ed9650fcc Catch all exceptions in test modules.
Guido van Rossum <guido@python.org>
parents: 5175
diff changeset
919 except:
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
920 type, value = sys.exc_info()[:2]
66720
04cec2e1ca41 Merged revisions 85086 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 65812
diff changeset
921 print >>sys.stderr, "test", test, "crashed --", str(type) + ":", value
04cec2e1ca41 Merged revisions 85086 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 65812
diff changeset
922 sys.stderr.flush()
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
923 if verbose:
66720
04cec2e1ca41 Merged revisions 85086 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 65812
diff changeset
924 traceback.print_exc(file=sys.stderr)
04cec2e1ca41 Merged revisions 85086 via svnmerge from
R. David Murray <rdmurray@bitdance.com>
parents: 65812
diff changeset
925 sys.stderr.flush()
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
926 return FAILED, test_time
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
927 else:
54088
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
928 if refleak:
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
929 return FAILED, test_time
56509
bdbda7a94c33 Enhanced Issue 7058 patch, which will not be backported. Refactors the
R. David Murray <rdmurray@bitdance.com>
parents: 56390
diff changeset
930 if environment.changed:
56979
9ddbd69815ca Fix constant name.
Georg Brandl <georg@python.org>
parents: 56976
diff changeset
931 return ENV_CHANGED, test_time
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
932 # Except in verbose mode, tests should not print anything
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
933 if verbose or huntrleaks:
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
934 return PASSED, test_time
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
935 output = capture_stdout.getvalue()
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
936 if not output:
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
937 return PASSED, test_time
20022
109def4a5f6e Change the way unexpected output is reported: rather than stopping at
Guido van Rossum <guido@python.org>
parents: 19969
diff changeset
938 print "test", test, "produced unexpected output:"
46192
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
939 print "*" * 70
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
940 print output
6e02ff0bd6f8 Now that Lib/test/output is gone, tests should not print anything,
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46144
diff changeset
941 print "*" * 70
25252
29559e21cd53 Add a bunch of sys.stdout.flush() calls that will hopefully improve
Guido van Rossum <guido@python.org>
parents: 25001
diff changeset
942 sys.stdout.flush()
56976
5f5e3c7da8cb Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
Georg Brandl <georg@python.org>
parents: 56946
diff changeset
943 return FAILED, test_time
20022
109def4a5f6e Change the way unexpected output is reported: rather than stopping at
Guido van Rossum <guido@python.org>
parents: 19969
diff changeset
944
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
945 def cleanup_test_droppings(testname, verbose):
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
946 import shutil
53625
94cdfd07d4f4 make sure mode is removable while cleaning up test droppings
Benjamin Peterson <benjamin@python.org>
parents: 53000
diff changeset
947 import stat
65811
f3afa10ce777 Merged revisions 85935-85936 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65631
diff changeset
948 import gc
f3afa10ce777 Merged revisions 85935-85936 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65631
diff changeset
949
f3afa10ce777 Merged revisions 85935-85936 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65631
diff changeset
950 # First kill any dangling references to open files etc.
f3afa10ce777 Merged revisions 85935-85936 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 65631
diff changeset
951 gc.collect()
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
952
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
953 # Try to clean up junk commonly left behind. While tests shouldn't leave
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
954 # any files or directories behind, when a test fails that can be tedious
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
955 # for it to arrange. The consequences can be especially nasty on Windows,
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
956 # since if a test leaves a file open, it cannot be deleted by name (while
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
957 # there's nothing we can do about that here either, we can display the
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
958 # name of the offending test, which is a real help).
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
959 for name in (test_support.TESTFN,
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
960 "db_home",
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
961 ):
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
962 if not os.path.exists(name):
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
963 continue
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
964
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
965 if os.path.isdir(name):
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
966 kind, nuker = "directory", shutil.rmtree
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
967 elif os.path.isfile(name):
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
968 kind, nuker = "file", os.unlink
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
969 else:
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
970 raise SystemError("os.path says %r exists but is neither "
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
971 "directory nor file" % name)
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
972
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
973 if verbose:
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
974 print "%r left behind %s %r" % (testname, kind, name)
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
975 try:
53625
94cdfd07d4f4 make sure mode is removable while cleaning up test droppings
Benjamin Peterson <benjamin@python.org>
parents: 53000
diff changeset
976 # if we have chmod, fix possible permissions problems
94cdfd07d4f4 make sure mode is removable while cleaning up test droppings
Benjamin Peterson <benjamin@python.org>
parents: 53000
diff changeset
977 # that might prevent cleanup
94cdfd07d4f4 make sure mode is removable while cleaning up test droppings
Benjamin Peterson <benjamin@python.org>
parents: 53000
diff changeset
978 if (hasattr(os, 'chmod')):
94cdfd07d4f4 make sure mode is removable while cleaning up test droppings
Benjamin Peterson <benjamin@python.org>
parents: 53000
diff changeset
979 os.chmod(name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
38699
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
980 nuker(name)
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
981 except Exception, msg:
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
982 print >> sys.stderr, ("%r left behind %s %r and it couldn't be "
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
983 "removed: %s" % (testname, kind, name, msg))
5a74193429f0 Implementing a happy idea from Georg Brandl: make runtest() try to
Tim Peters <tim.peters@gmail.com>
parents: 38683
diff changeset
984
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
985 def dash_R(the_module, test, indirect_test, huntrleaks):
54088
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
986 """Run a test multiple times, looking for reference leaks.
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
987
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
988 Returns:
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
989 False if the test didn't leak references; True if we detected refleaks.
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
990 """
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
991 # This code is hackish and inelegant, but it seems to do the job.
55483
8898f28e6d2c "Fix" for the refleak report: the ABC classes are now in the _pyio module
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54968
diff changeset
992 import copy_reg, _abcoll, _pyio
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
993
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
994 if not hasattr(sys, 'gettotalrefcount'):
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
995 raise Exception("Tracking reference leaks requires a debug build "
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
996 "of Python")
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
997
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
998 # Save current values for dash_R_cleanup() to restore.
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
999 fs = warnings.filters[:]
47189
f419b2e96a98 Revert copy_reg -> copyreg rename.
Georg Brandl <georg@python.org>
parents: 46865
diff changeset
1000 ps = copy_reg.dispatch_table.copy()
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1001 pic = sys.path_importer_cache.copy()
57288
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1002 try:
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1003 import zipimport
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1004 except ImportError:
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1005 zdc = None # Run unmodified on platforms without zipimport support
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1006 else:
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1007 zdc = zipimport._zip_directory_cache.copy()
43958
103b7f955036 Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
Guido van Rossum <guido@python.org>
parents: 43808
diff changeset
1008 abcs = {}
55483
8898f28e6d2c "Fix" for the refleak report: the ABC classes are now in the _pyio module
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54968
diff changeset
1009 modules = _abcoll, _pyio
46248
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1010 for abc in [getattr(mod, a) for mod in modules for a in mod.__all__]:
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1011 # XXX isinstance(abc, ABCMeta) leads to infinite recursion
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1012 if not hasattr(abc, '_abc_registry'):
44080
80b42db2eac9 Backport of -r59242:59246 from py3k
Christian Heimes <christian@cheimes.de>
parents: 43958
diff changeset
1013 continue
43958
103b7f955036 Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
Guido van Rossum <guido@python.org>
parents: 43808
diff changeset
1014 for obj in abc.__subclasses__() + [abc]:
103b7f955036 Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
Guido van Rossum <guido@python.org>
parents: 43808
diff changeset
1015 abcs[obj] = obj._abc_registry.copy()
103b7f955036 Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
Guido van Rossum <guido@python.org>
parents: 43808
diff changeset
1016
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1017 if indirect_test:
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1018 def run_the_test():
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1019 indirect_test()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1020 else:
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1021 def run_the_test():
63556
dba99828d91c Merged revisions 77942,79023 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents: 61013
diff changeset
1022 imp.reload(the_module)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1023
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1024 deltas = []
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1025 nwarmup, ntracked, fname = huntrleaks
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1026 fname = os.path.join(test_support.SAVEDCWD, fname)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1027 repcount = nwarmup + ntracked
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1028 print >> sys.stderr, "beginning", repcount, "repetitions"
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1029 print >> sys.stderr, ("1234567890"*(repcount//10 + 1))[:repcount]
57288
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1030 dash_R_cleanup(fs, ps, pic, zdc, abcs)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1031 for i in range(repcount):
59655
190eadaeabc5 Fix a trivial class of (hypothetical, future) false-positive refleaks, discovered by an optimization in Unladen Swallow's past (which will become CPython's future).
Collin Winter <collinw@gmail.com>
parents: 59406
diff changeset
1032 rc_before = sys.gettotalrefcount()
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1033 run_the_test()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1034 sys.stderr.write('.')
57288
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1035 dash_R_cleanup(fs, ps, pic, zdc, abcs)
59655
190eadaeabc5 Fix a trivial class of (hypothetical, future) false-positive refleaks, discovered by an optimization in Unladen Swallow's past (which will become CPython's future).
Collin Winter <collinw@gmail.com>
parents: 59406
diff changeset
1036 rc_after = sys.gettotalrefcount()
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1037 if i >= nwarmup:
59655
190eadaeabc5 Fix a trivial class of (hypothetical, future) false-positive refleaks, discovered by an optimization in Unladen Swallow's past (which will become CPython's future).
Collin Winter <collinw@gmail.com>
parents: 59406
diff changeset
1038 deltas.append(rc_after - rc_before)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1039 print >> sys.stderr
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1040 if any(deltas):
41686
4367b7af7531 Don't ever report a failure when the sum of the reference count differences
Neal Norwitz <nnorwitz@gmail.com>
parents: 41127
diff changeset
1041 msg = '%s leaked %s references, sum=%s' % (test, deltas, sum(deltas))
4367b7af7531 Don't ever report a failure when the sum of the reference count differences
Neal Norwitz <nnorwitz@gmail.com>
parents: 41127
diff changeset
1042 print >> sys.stderr, msg
54465
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
1043 with open(fname, "a") as refrep:
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
1044 print >> refrep, msg
d74b8edd7a8c Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
Antoine Pitrou <solipsis@pitrou.net>
parents: 54088
diff changeset
1045 refrep.flush()
54088
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
1046 return True
b600e5103c63 Issue 6024: make regrtest.py promote refleaks to test failures.
Collin Winter <collinw@gmail.com>
parents: 53625
diff changeset
1047 return False
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1048
57288
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1049 def dash_R_cleanup(fs, ps, pic, zdc, abcs):
47189
f419b2e96a98 Revert copy_reg -> copyreg rename.
Georg Brandl <georg@python.org>
parents: 46865
diff changeset
1050 import gc, copy_reg
46838
33d4e03b23ba Deprecate the dircache module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents: 46675
diff changeset
1051 import _strptime, linecache
33d4e03b23ba Deprecate the dircache module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents: 46675
diff changeset
1052 dircache = test_support.import_module('dircache', deprecated=True)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1053 import urlparse, urllib, urllib2, mimetypes, doctest
46248
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1054 import struct, filecmp
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1055 from distutils.dir_util import _path_created
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1056
46474
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46248
diff changeset
1057 # Clear the warnings registry, so they can be displayed again
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46248
diff changeset
1058 for mod in sys.modules.values():
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46248
diff changeset
1059 if hasattr(mod, '__warningregistry__'):
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46248
diff changeset
1060 del mod.__warningregistry__
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46248
diff changeset
1061
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1062 # Restore some original values.
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1063 warnings.filters[:] = fs
47189
f419b2e96a98 Revert copy_reg -> copyreg rename.
Georg Brandl <georg@python.org>
parents: 46865
diff changeset
1064 copy_reg.dispatch_table.clear()
f419b2e96a98 Revert copy_reg -> copyreg rename.
Georg Brandl <georg@python.org>
parents: 46865
diff changeset
1065 copy_reg.dispatch_table.update(ps)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1066 sys.path_importer_cache.clear()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1067 sys.path_importer_cache.update(pic)
57288
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1068 try:
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1069 import zipimport
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1070 except ImportError:
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1071 pass # Run unmodified on platforms without zipimport support
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1072 else:
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1073 zipimport._zip_directory_cache.clear()
401d223705b7 Account for another cache when hunting ref leaks
Nick Coghlan <ncoghlan@gmail.com>
parents: 57246
diff changeset
1074 zipimport._zip_directory_cache.update(zdc)
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1075
45025
ea3fe302d392 Added clear cache methods to clear the internal type lookup cache for ref leak test runs.
Christian Heimes <christian@cheimes.de>
parents: 44459
diff changeset
1076 # clear type cache
45143
8fdd6d62ea55 Patch #1953
Christian Heimes <christian@cheimes.de>
parents: 45025
diff changeset
1077 sys._clear_type_cache()
45025
ea3fe302d392 Added clear cache methods to clear the internal type lookup cache for ref leak test runs.
Christian Heimes <christian@cheimes.de>
parents: 44459
diff changeset
1078
43958
103b7f955036 Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
Guido van Rossum <guido@python.org>
parents: 43808
diff changeset
1079 # Clear ABC registries, restoring previously saved ABC registries.
46248
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1080 for abc, registry in abcs.items():
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1081 abc._abc_registry = registry.copy()
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1082 abc._abc_cache.clear()
5939900d98d2 Correct the apparent refleak in test_io:
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 46192
diff changeset
1083 abc._abc_negative_cache.clear()
43958
103b7f955036 Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
Guido van Rossum <guido@python.org>
parents: 43808
diff changeset
1084
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1085 # Clear assorted module caches.
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1086 _path_created.clear()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1087 re.purge()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1088 _strptime._regex_cache.clear()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1089 urlparse.clear_cache()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1090 urllib.urlcleanup()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1091 urllib2.install_opener(None)
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1092 dircache.reset()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1093 linecache.clearcache()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1094 mimetypes._default_mime_types()
38637
3a36d5f5b10f dash_R_cleanup(): Clear filecmp._cache. This accounts for
Tim Peters <tim.peters@gmail.com>
parents: 38597
diff changeset
1095 filecmp._cache.clear()
44459
7643a43f25a1 Added _struct._clearcache() for regression tests
Christian Heimes <christian@cheimes.de>
parents: 44458
diff changeset
1096 struct._clearcache()
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1097 doctest.master = None
73750
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1098 try:
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1099 import ctypes
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1100 except ImportError:
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1101 # Don't worry about resetting the cache if ctypes is not supported
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1102 pass
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1103 else:
6783aa5c15ae Issue #13380: add an internal function for resetting the ctypes caches
Meador Inge <meadori@gmail.com>
parents: 69217
diff changeset
1104 ctypes._reset_cache()
38597
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1105
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1106 # Collect cyclic trash.
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1107 gc.collect()
c05ef08e1ba9 "Flat is better than nested."
Tim Peters <tim.peters@gmail.com>
parents: 38472
diff changeset
1108
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1109 def findtestdir(path=None):
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1110 return path or os.path.dirname(__file__) or os.curdir
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1111
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1112 def removepy(names):
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1113 if not names:
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1114 return
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1115 for idx, name in enumerate(names):
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1116 basename, ext = os.path.splitext(name)
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1117 if ext == '.py':
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1118 names[idx] = basename
23643
70d76833550b regrtest has a new
Tim Peters <tim.peters@gmail.com>
parents: 23316
diff changeset
1119
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1120 def count(n, word):
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1121 if n == 1:
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
1122 return "%d %s" % (n, word)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1123 else:
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6505
diff changeset
1124 return "%d %ss" % (n, word)
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1125
19193
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1126 def printlist(x, width=70, indent=4):
25001
fcb5201c69ed Got rid of the toy _Set class, in favor of sets.Set.
Tim Peters <tim.peters@gmail.com>
parents: 24829
diff changeset
1127 """Print the elements of iterable x to stdout.
19193
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1128
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1129 Optional arg width (default 70) is the maximum line length.
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1130 Optional arg indent (default 4) is the number of blanks with which to
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1131 begin each line.
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1132 """
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1133
24113
f35e29aa0d92 printlist(): Replaced the guts with a call to textwrap. Yay!
Tim Peters <tim.peters@gmail.com>
parents: 23777
diff changeset
1134 from textwrap import fill
f35e29aa0d92 printlist(): Replaced the guts with a call to textwrap. Yay!
Tim Peters <tim.peters@gmail.com>
parents: 23777
diff changeset
1135 blanks = ' ' * indent
60060
0bc04525af63 Merged revisions 79195,79425,79427,79450 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 57247
diff changeset
1136 # Print the sorted list: 'x' may be a '--random' list or a set()
0bc04525af63 Merged revisions 79195,79425,79427,79450 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 57247
diff changeset
1137 print fill(' '.join(str(elt) for elt in sorted(x)), width,
24113
f35e29aa0d92 printlist(): Replaced the guts with a call to textwrap. Yay!
Tim Peters <tim.peters@gmail.com>
parents: 23777
diff changeset
1138 initial_indent=blanks, subsequent_indent=blanks)
19193
095c89a825a9 Make the output of tests skipped readable (i.e., deliberately break it
Tim Peters <tim.peters@gmail.com>
parents: 19189
diff changeset
1139
22723
1e3062e69f2c We expect to skip the new test_mpz on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 22287
diff changeset
1140 # Map sys.platform to a string containing the basenames of tests
1e3062e69f2c We expect to skip the new test_mpz on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 22287
diff changeset
1141 # expected to be skipped on that platform.
25674
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1142 #
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1143 # Special cases:
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1144 # test_pep277
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1145 # The _ExpectedSkips constructor adds this to the set of expected
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1146 # skips if not os.path.supports_unicode_filenames.
28112
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1147 # test_timeout
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1148 # Controlled by test_timeout.skip_expected. Requires the network
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1149 # resource and a socket module.
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1150 #
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1151 # Tests that are expected to be skipped everywhere except on one platform
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1152 # are also handled separately.
22723
1e3062e69f2c We expect to skip the new test_mpz on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 22287
diff changeset
1153
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1154 _expectations = {
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1155 'win32':
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1156 """
30472
084408fee961 test__locale (two underscores) can't pass on Windows: RADIXCHAR doesn't
Tim Peters <tim.peters@gmail.com>
parents: 29978
diff changeset
1157 test__locale
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1158 test_bsddb185
26354
35f125d52cf5 Move Windows Python away from bsddb 1.85 and toward Sleepycat's latest.
Tim Peters <tim.peters@gmail.com>
parents: 26288
diff changeset
1159 test_bsddb3
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1160 test_commands
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1161 test_crypt
20622
aa5647569ee2 Record that test_curses doesn't run on win32.
Tim Peters <tim.peters@gmail.com>
parents: 20610
diff changeset
1162 test_curses
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1163 test_dbm
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1164 test_dl
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1165 test_fcntl
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1166 test_fork1
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1167 test_epoll
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1168 test_gdbm
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1169 test_grp
28157
8a71301afc2d test_ioctl is an expected skip on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 28112
diff changeset
1170 test_ioctl
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1171 test_largefile
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1172 test_kqueue
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1173 test_mhlib
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1174 test_openpty
26587
81032e97ba3c Added test_ossaudiodev to expected skips on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 26539
diff changeset
1175 test_ossaudiodev
43042
8b0b1146d908 Patch #1680959: add test suite for pipes module.
Georg Brandl <georg@python.org>
parents: 42221
diff changeset
1176 test_pipes
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1177 test_poll
27922
efc465810e1e test_posix is an expected skip on Win32. Also fixed test_posix to
Tim Peters <tim.peters@gmail.com>
parents: 27896
diff changeset
1178 test_posix
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1179 test_pty
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1180 test_pwd
23264
b572f7a0bb56 test_resource has no chance of running on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 23202
diff changeset
1181 test_resource
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1182 test_signal
32948
953ce5af10a3 test_threadsignals is an expected skip on win32.
Tim Peters <tim.peters@gmail.com>
parents: 32924
diff changeset
1183 test_threadsignals
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1184 test_timing
37135
7dadd3fc5efa Record that test_wait[34] get skipped on native Windows.
Tim Peters <tim.peters@gmail.com>
parents: 37017
diff changeset
1185 test_wait3
7dadd3fc5efa Record that test_wait[34] get skipped on native Windows.
Tim Peters <tim.peters@gmail.com>
parents: 37017
diff changeset
1186 test_wait4
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1187 """,
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1188 'linux2':
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1189 """
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1190 test_bsddb185
20630
e496b85229c7 test_curses is an expected skip on Linux too.
Guido van Rossum <guido@python.org>
parents: 20622
diff changeset
1191 test_curses
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1192 test_dl
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1193 test_largefile
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1194 test_kqueue
27896
4e31e4086849 - The audio driver tests (test_ossaudiodev.py and
Guido van Rossum <guido@python.org>
parents: 27865
diff changeset
1195 test_ossaudiodev
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1196 """,
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1197 'unixware7':
19729
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1198 """
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1199 test_bsddb
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1200 test_bsddb185
19729
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1201 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1202 test_epoll
19729
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1203 test_largefile
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1204 test_kqueue
19729
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1205 test_minidom
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1206 test_openpty
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1207 test_pyexpat
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1208 test_sax
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1209 test_sundry
deb08af89a35 Patch #453627: Adds a list of tests that are expected to be skipped for UnixWare 7.x systems.
Martin v. Löwis <martin@v.loewis.de>
parents: 19651
diff changeset
1210 """,
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1211 'openunix8':
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1212 """
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1213 test_bsddb
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1214 test_bsddb185
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1215 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1216 test_epoll
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1217 test_largefile
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1218 test_kqueue
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1219 test_minidom
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1220 test_openpty
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1221 test_pyexpat
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1222 test_sax
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1223 test_sundry
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1224 """,
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1225 'sco_sv3':
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1226 """
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1227 test_asynchat
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1228 test_bsddb
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1229 test_bsddb185
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1230 test_dl
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1231 test_fork1
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1232 test_epoll
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1233 test_gettext
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1234 test_largefile
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1235 test_locale
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1236 test_kqueue
25497
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1237 test_minidom
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1238 test_openpty
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1239 test_pyexpat
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1240 test_queue
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1241 test_sax
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1242 test_sundry
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1243 test_thread
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1244 test_threaded_import
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1245 test_threadedtempfile
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1246 test_threading
b526e12b941b Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents: 25326
diff changeset
1247 """,
20654
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1248 'riscos':
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1249 """
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1250 test_asynchat
29066
90342f395721 Patch #734231: Update RiscOS support. In particular, correct
Martin v. Löwis <martin@v.loewis.de>
parents: 28993
diff changeset
1251 test_atexit
20654
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1252 test_bsddb
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1253 test_bsddb185
29066
90342f395721 Patch #734231: Update RiscOS support. In particular, correct
Martin v. Löwis <martin@v.loewis.de>
parents: 28993
diff changeset
1254 test_bsddb3
20654
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1255 test_commands
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1256 test_crypt
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1257 test_dbm
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1258 test_dl
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1259 test_fcntl
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1260 test_fork1
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1261 test_epoll
20654
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1262 test_gdbm
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1263 test_grp
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1264 test_largefile
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1265 test_locale
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1266 test_kqueue
20654
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1267 test_mmap
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1268 test_openpty
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1269 test_poll
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1270 test_popen2
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1271 test_pty
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1272 test_pwd
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1273 test_strop
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1274 test_sundry
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1275 test_thread
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1276 test_threaded_import
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1277 test_threadedtempfile
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1278 test_threading
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1279 test_timing
edd9d0b3c47e SF patch #474590 -- RISC OS support
Guido van Rossum <guido@python.org>
parents: 20630
diff changeset
1280 """,
21244
1289a0559e5a sys.platform on Mac OS X is now "darwin", without any version number appended.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21140
diff changeset
1281 'darwin':
21140
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1282 """
30686
0060157844d8 Add test__locale to expected skip list for Darwin.
Brett Cannon <bcannon@gmail.com>
parents: 30472
diff changeset
1283 test__locale
26900
18d4f71f5ed6 Updated the expected skips for MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26587
diff changeset
1284 test_bsddb
26512
376bd357c4d5 Some more expected skips on OSX.
Guido van Rossum <guido@python.org>
parents: 26492
diff changeset
1285 test_bsddb3
21140
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1286 test_curses
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1287 test_epoll
65631
f570da9a43f8 test_gdb should be skipped on darwin (not up to v7 yet)
Skip Montanaro <skip@pobox.com>
parents: 65318
diff changeset
1288 test_gdb
21140
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1289 test_gdbm
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1290 test_largefile
26900
18d4f71f5ed6 Updated the expected skips for MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26587
diff changeset
1291 test_locale
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1292 test_kqueue
21140
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1293 test_minidom
26900
18d4f71f5ed6 Updated the expected skips for MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26587
diff changeset
1294 test_ossaudiodev
21140
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1295 test_poll
1c6c027fd110 Added tests expected to be skipped on Mac OS X.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21113
diff changeset
1296 """,
24274
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1297 'sunos5':
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1298 """
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1299 test_bsddb
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1300 test_bsddb185
24274
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1301 test_curses
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1302 test_dbm
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1303 test_epoll
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1304 test_kqueue
24274
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1305 test_gdbm
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1306 test_gzip
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1307 test_openpty
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1308 test_zipfile
1cebce50fe71 Add a rather generous set of tests allowed to be skipped on sunos5.
Guido van Rossum <guido@python.org>
parents: 24263
diff changeset
1309 test_zlib
24277
eb04f17cc008 Add missing comma.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 24274
diff changeset
1310 """,
22287
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1311 'hp-ux11':
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1312 """
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1313 test_bsddb
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1314 test_bsddb185
22287
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1315 test_curses
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1316 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1317 test_epoll
22287
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1318 test_gdbm
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1319 test_gzip
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1320 test_largefile
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1321 test_locale
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1322 test_kqueue
22287
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1323 test_minidom
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1324 test_openpty
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1325 test_pyexpat
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1326 test_sax
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1327 test_zipfile
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1328 test_zlib
e4e54fc5fb3d first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP.
Skip Montanaro <skip@pobox.com>
parents: 21890
diff changeset
1329 """,
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23733
diff changeset
1330 'atheos':
24263
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1331 """
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1332 test_bsddb185
24263
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1333 test_curses
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1334 test_dl
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1335 test_gdbm
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1336 test_epoll
24263
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1337 test_largefile
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1338 test_locale
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1339 test_kqueue
24263
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1340 test_mhlib
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1341 test_mmap
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1342 test_poll
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1343 test_popen2
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1344 test_resource
e6033254df21 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 24113
diff changeset
1345 """,
26538
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1346 'cygwin':
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1347 """
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1348 test_bsddb185
26539
0e6e39fb9cd7 Add a Cygwin skip mentioned by Jason Tishler.
Tim Peters <tim.peters@gmail.com>
parents: 26538
diff changeset
1349 test_bsddb3
26538
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1350 test_curses
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1351 test_dbm
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1352 test_epoll
29974
d37f13199d95 Patch #775784: YA Cygwin expected regression test skip patch
Jason Tishler <jason@tishler.net>
parents: 29374
diff changeset
1353 test_ioctl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1354 test_kqueue
26538
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1355 test_largefile
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1356 test_locale
27700
614abba5b762 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 27636
diff changeset
1357 test_ossaudiodev
26538
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1358 test_socketserver
2621968319f0 Patch #551977: Regression exceptions for cygwin
Jason Tishler <jason@tishler.net>
parents: 26527
diff changeset
1359 """,
26938
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1360 'os2emx':
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1361 """
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1362 test_audioop
28993
f1fcac4cabad the new bsddb185 module is an expected skip on most platforms (this may not
Skip Montanaro <skip@pobox.com>
parents: 28798
diff changeset
1363 test_bsddb185
26938
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1364 test_bsddb3
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1365 test_commands
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1366 test_curses
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1367 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1368 test_epoll
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1369 test_kqueue
26938
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1370 test_largefile
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1371 test_mhlib
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1372 test_mmap
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1373 test_openpty
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1374 test_ossaudiodev
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1375 test_pty
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1376 test_resource
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1377 test_signal
a82d92f78472 add list of expected skips for the OS/2 EMX port
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents: 26900
diff changeset
1378 """,
30989
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1379 'freebsd4':
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1380 """
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1381 test_bsddb
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1382 test_bsddb3
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1383 test_epoll
33180
aad118643598 Add support for FreeBSD 6.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 33105
diff changeset
1384 test_gdbm
30989
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1385 test_locale
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1386 test_ossaudiodev
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1387 test_pep277
33180
aad118643598 Add support for FreeBSD 6.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 33105
diff changeset
1388 test_pty
30989
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1389 test_socketserver
33180
aad118643598 Add support for FreeBSD 6.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 33105
diff changeset
1390 test_tcl
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents: 51140
diff changeset
1391 test_tk
51138
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1392 test_ttk_guionly
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1393 test_ttk_textonly
30989
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1394 test_timeout
4f6382d2809d test_applesingle is an expected skip almost anywhere.
Guido van Rossum <guido@python.org>
parents: 30987
diff changeset
1395 test_urllibnet
49346
b4964df64384 issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller
Jesse Noller <jnoller@gmail.com>
parents: 48017
diff changeset
1396 test_multiprocessing
29374
23f6101cc87e Patch #746801: FreeBSD 4 expected failures, by Charles Swiger.
Martin v. Löwis <martin@v.loewis.de>
parents: 29155
diff changeset
1397 """,
35550
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1398 'aix5':
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1399 """
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1400 test_bsddb
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1401 test_bsddb185
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1402 test_bsddb3
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1403 test_bz2
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1404 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1405 test_epoll
35550
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1406 test_gdbm
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1407 test_gzip
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1408 test_kqueue
35550
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1409 test_ossaudiodev
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1410 test_tcl
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents: 51140
diff changeset
1411 test_tk
51138
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1412 test_ttk_guionly
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1413 test_ttk_textonly
35550
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1414 test_zipimport
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1415 test_zlib
724bbd489ad4 - Changes donated by Elemental Security to make it work on AIX 5.3
Guido van Rossum <guido@python.org>
parents: 35375
diff changeset
1416 """,
37226
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1417 'openbsd3':
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1418 """
59980
532d71420f46 Skip test_ascii_formatd if _ctypes is not available (BSD, ...).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59655
diff changeset
1419 test_ascii_formatd
37226
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1420 test_bsddb
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1421 test_bsddb3
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1422 test_ctypes
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1423 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1424 test_epoll
37226
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1425 test_gdbm
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1426 test_locale
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1427 test_normalization
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1428 test_ossaudiodev
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1429 test_pep277
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1430 test_tcl
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents: 51140
diff changeset
1431 test_tk
51138
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1432 test_ttk_guionly
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1433 test_ttk_textonly
49346
b4964df64384 issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller
Jesse Noller <jnoller@gmail.com>
parents: 48017
diff changeset
1434 test_multiprocessing
37226
799b40c4a2c6 Patch from Aldo Cortesi: expected skips for OpenBSD.
Martin v. Löwis <martin@v.loewis.de>
parents: 37135
diff changeset
1435 """,
38902
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1436 'netbsd3':
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1437 """
59980
532d71420f46 Skip test_ascii_formatd if _ctypes is not available (BSD, ...).
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59655
diff changeset
1438 test_ascii_formatd
38902
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1439 test_bsddb
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1440 test_bsddb185
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1441 test_bsddb3
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1442 test_ctypes
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1443 test_curses
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1444 test_dl
45991
728dc13327b2 Applied patch #1657 epoll and kqueue wrappers for the select module
Christian Heimes <christian@cheimes.de>
parents: 45989
diff changeset
1445 test_epoll
38902
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1446 test_gdbm
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1447 test_locale
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1448 test_ossaudiodev
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1449 test_pep277
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1450 test_tcl
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents: 51140
diff changeset
1451 test_tk
51138
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1452 test_ttk_guionly
946340fb114b * Renaming test_tk_* to test_ttk_* since that is what they are testing.
Guilherme Polo <ggpolo@gmail.com>
parents: 49346
diff changeset
1453 test_ttk_textonly
49346
b4964df64384 issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller
Jesse Noller <jnoller@gmail.com>
parents: 48017
diff changeset
1454 test_multiprocessing
38902
69ef23fcf5f8 Patch #1509001: expected skips for netbsd3.
Georg Brandl <georg@python.org>
parents: 38741
diff changeset
1455 """,
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1456 }
32815
ee7b84101160 Patch #995782: Add FreeBSD 5 expectations. Will backport to 2.3.
Martin v. Löwis <martin@v.loewis.de>
parents: 32754
diff changeset
1457 _expectations['freebsd5'] = _expectations['freebsd4']
33180
aad118643598 Add support for FreeBSD 6.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 33105
diff changeset
1458 _expectations['freebsd6'] = _expectations['freebsd4']
35238
526faaab00eb Add support for FreeBSD 7.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 35077
diff changeset
1459 _expectations['freebsd7'] = _expectations['freebsd4']
43703
365913d7af7d Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
Hye-Shik Chang <hyeshik@gmail.com>
parents: 43325
diff changeset
1460 _expectations['freebsd8'] = _expectations['freebsd4']
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1461
19186
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1462 class _ExpectedSkips:
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1463 def __init__(self):
25674
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1464 import os.path
28112
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1465 from test import test_timeout
26391
d207d1d78c5d Fiddled things so that test_normalization is expected to be skipped if
Tim Peters <tim.peters@gmail.com>
parents: 26389
diff changeset
1466
25001
fcb5201c69ed Got rid of the toy _Set class, in favor of sets.Set.
Tim Peters <tim.peters@gmail.com>
parents: 24829
diff changeset
1467 self.valid = False
22723
1e3062e69f2c We expect to skip the new test_mpz on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 22287
diff changeset
1468 if sys.platform in _expectations:
19189
115e4099f3d9 Add the list of expected skips for Linux 2.x. Restructured the code a
Guido van Rossum <guido@python.org>
parents: 19188
diff changeset
1469 s = _expectations[sys.platform]
30929
54ff68e973ee * Migrate set() and frozenset() from the sandbox.
Raymond Hettinger <python@rcn.com>
parents: 30686
diff changeset
1470 self.expected = set(s.split())
26391
d207d1d78c5d Fiddled things so that test_normalization is expected to be skipped if
Tim Peters <tim.peters@gmail.com>
parents: 26389
diff changeset
1471
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1472 # expected to be skipped on every platform, even Linux
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1473 self.expected.add('test_linuxaudiodev')
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1474
25674
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1475 if not os.path.supports_unicode_filenames:
62853195be68 Logic for determining whether skipping test_pep277 is expected: whether
Tim Peters <tim.peters@gmail.com>
parents: 25617
diff changeset
1476 self.expected.add('test_pep277')
26391
d207d1d78c5d Fiddled things so that test_normalization is expected to be skipped if
Tim Peters <tim.peters@gmail.com>
parents: 26389
diff changeset
1477
28112
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1478 if test_timeout.skip_expected:
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1479 self.expected.add('test_timeout')
2c8c2c6b2ab7 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
Neal Norwitz <nnorwitz@gmail.com>
parents: 28081
diff changeset
1480
33986
49b6e966e57f Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents: 33982
diff changeset
1481 if sys.maxint == 9223372036854775807L:
49b6e966e57f Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents: 33982
diff changeset
1482 self.expected.add('test_imageop')
49b6e966e57f Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents: 33982
diff changeset
1483
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 61028
diff changeset
1484 if sys.platform != "darwin":
47770
e107062aa9cd test_macos can be skipped on non-mac platforms.
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 47189
diff changeset
1485 MAC_ONLY = ["test_macos", "test_macostools", "test_aepack",
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1486 "test_plistlib", "test_scriptpackages",
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1487 "test_applesingle"]
28438
d7001fadfefc Move Mac/Windows specific expected skips from each platform list
Neal Norwitz <nnorwitz@gmail.com>
parents: 28277
diff changeset
1488 for skip in MAC_ONLY:
d7001fadfefc Move Mac/Windows specific expected skips from each platform list
Neal Norwitz <nnorwitz@gmail.com>
parents: 28277
diff changeset
1489 self.expected.add(skip)
47773
db62c448a349 skip test_macostools when UCS4 is enabled
Benjamin Peterson <benjamin@python.org>
parents: 47770
diff changeset
1490 elif len(u'\0'.encode('unicode-internal')) == 4:
db62c448a349 skip test_macostools when UCS4 is enabled
Benjamin Peterson <benjamin@python.org>
parents: 47770
diff changeset
1491 self.expected.add("test_macostools")
db62c448a349 skip test_macostools when UCS4 is enabled
Benjamin Peterson <benjamin@python.org>
parents: 47770
diff changeset
1492
27504
0dd8d8a76015 Expect test_macostools and test_macfs to get skipped whenever
Tim Peters <tim.peters@gmail.com>
parents: 27420
diff changeset
1493
0dd8d8a76015 Expect test_macostools and test_macfs to get skipped whenever
Tim Peters <tim.peters@gmail.com>
parents: 27420
diff changeset
1494 if sys.platform != "win32":
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1495 # test_sqlite is only reliable on Windows where the library
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1496 # is distributed with Python
28438
d7001fadfefc Move Mac/Windows specific expected skips from each platform list
Neal Norwitz <nnorwitz@gmail.com>
parents: 28277
diff changeset
1497 WIN_ONLY = ["test_unicode_file", "test_winreg",
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1498 "test_winsound", "test_startfile",
69217
8b146103d29e Issue #11719: Fix message about unexpected test_msilib skip.
Ross Lagerwall <rosslagerwall@gmail.com>
parents: 68256
diff changeset
1499 "test_sqlite", "test_msilib"]
28438
d7001fadfefc Move Mac/Windows specific expected skips from each platform list
Neal Norwitz <nnorwitz@gmail.com>
parents: 28277
diff changeset
1500 for skip in WIN_ONLY:
d7001fadfefc Move Mac/Windows specific expected skips from each platform list
Neal Norwitz <nnorwitz@gmail.com>
parents: 28277
diff changeset
1501 self.expected.add(skip)
27963
226463445697 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27922
diff changeset
1502
41784
b7fb942b403e Remove the rgbimg module. It has been deprecated since Python 2.5.
Brett Cannon <bcannon@gmail.com>
parents: 41686
diff changeset
1503 if sys.platform != 'irix':
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1504 IRIX_ONLY = ["test_imageop", "test_al", "test_cd", "test_cl",
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1505 "test_gl", "test_imgfile"]
41784
b7fb942b403e Remove the rgbimg module. It has been deprecated since Python 2.5.
Brett Cannon <bcannon@gmail.com>
parents: 41686
diff changeset
1506 for skip in IRIX_ONLY:
b7fb942b403e Remove the rgbimg module. It has been deprecated since Python 2.5.
Brett Cannon <bcannon@gmail.com>
parents: 41686
diff changeset
1507 self.expected.add(skip)
b7fb942b403e Remove the rgbimg module. It has been deprecated since Python 2.5.
Brett Cannon <bcannon@gmail.com>
parents: 41686
diff changeset
1508
42221
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1509 if sys.platform != 'sunos5':
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1510 self.expected.add('test_sunaudiodev')
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1511 self.expected.add('test_nis')
2c33df09c1c7 Patch #1731169: clean up expected skips list.
Georg Brandl <georg@python.org>
parents: 41793
diff changeset
1512
45989
1f8ba5e8a2fa Replace hack in regrtest.py with use of sys.py3kwarning.
Steven Bethard <steven.bethard@gmail.com>
parents: 45881
diff changeset
1513 if not sys.py3kwarning:
1f8ba5e8a2fa Replace hack in regrtest.py with use of sys.py3kwarning.
Steven Bethard <steven.bethard@gmail.com>
parents: 45881
diff changeset
1514 self.expected.add('test_py3kwarn')
45881
b0d01969bbc8 Have regrtest skip test_py3kwarn when the -3 flag is missing.
Steven Bethard <steven.bethard@gmail.com>
parents: 45863
diff changeset
1515
25001
fcb5201c69ed Got rid of the toy _Set class, in favor of sets.Set.
Tim Peters <tim.peters@gmail.com>
parents: 24829
diff changeset
1516 self.valid = True
19186
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1517
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1518 def isvalid(self):
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1519 "Return true iff _ExpectedSkips knows about the current platform."
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1520 return self.valid
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1521
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1522 def getexpected(self):
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1523 """Return set of test names we expect to skip on current platform.
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1524
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1525 self.isvalid() must be true.
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1526 """
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1527
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1528 assert self.isvalid()
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1529 return self.expected
cdd0c7a45575 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
Tim Peters <tim.peters@gmail.com>
parents: 17994
diff changeset
1530
4794
80c0ca424510 New regression test harness. See usage message / doc string.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1531 if __name__ == '__main__':
64713
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1532 # findtestdir() gets the dirname out of __file__, so we have to make it
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1533 # absolute before changing the working directory.
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1534 # For example __file__ may be relative when running trace or profile.
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1535 # See issue #9323.
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1536 __file__ = os.path.abspath(__file__)
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1537
2ad8d7cbceab Merged revisions 83524,84776 via svnmerge from
Florent Xicluna <florent.xicluna@gmail.com>
parents: 64147
diff changeset
1538 # sanity check
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1539 assert __file__ == os.path.abspath(sys.argv[0])
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1540
59393
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1541 # When tests are run from the Python build directory, it is best practice
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1542 # to keep the test files in a subfolder. It eases the cleanup of leftover
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1543 # files using command "make distclean".
5b1764374545 Keep the test files in the ./build/ subdirectory, if Python is not installed.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 58856
diff changeset
1544 if sysconfig.is_python_build():
60895
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
1545 TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build')
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
1546 TEMPDIR = os.path.abspath(TEMPDIR)
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
1547 if not os.path.exists(TEMPDIR):
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
1548 os.mkdir(TEMPDIR)
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1549
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1550 # Define a writable temp dir that will be used as cwd while running
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1551 # the tests. The name of the dir includes the pid to allow parallel
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1552 # testing (see the -j option).
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1553 TESTCWD = 'test_python_{}'.format(os.getpid())
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1554
60895
a059ea966b8c Fix the "regrtest -s" switch.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 60894
diff changeset
1555 TESTCWD = os.path.join(TEMPDIR, TESTCWD)
58856
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1556
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1557 # Run the tests in a context manager that temporary changes the CWD to a
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1558 # temporary and writable directory. If it's not possible to create or
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1559 # change the CWD, the original CWD will be used. The original CWD is
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1560 # available from test_support.SAVEDCWD.
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1561 with test_support.temp_cwd(TESTCWD, quiet=True):
d1e2f794d020 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 58817
diff changeset
1562 main()