Skip to content

Commit de1769f

Browse files
authored
gh-142389: Add colour to regrtest and pdb's help descriptions (#149332)
1 parent 3efd2f4 commit de1769f

3 files changed

Lines changed: 50 additions & 48 deletions

File tree

Lib/pdb.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3713,18 +3713,18 @@ def help():
37133713
pydoc.pager(__doc__)
37143714

37153715
_usage = """\
3716-
Debug the Python program given by pyfile. Alternatively,
3716+
Debug the Python program given by `pyfile`. Alternatively,
37173717
an executable module or package to debug can be specified using
3718-
the -m switch. You can also attach to a running Python process
3719-
using the -p option with its PID.
3718+
the `-m` switch. You can also attach to a running Python process
3719+
using the `-p` option with its PID.
37203720
3721-
Initial commands are read from .pdbrc files in your home directory
3721+
Initial commands are read from `.pdbrc` files in your home directory
37223722
and in the current directory, if they exist. Commands supplied with
3723-
-c are executed after commands from .pdbrc files.
3723+
`-c` are executed after commands from `.pdbrc` files.
37243724
3725-
To let the script run until an exception occurs, use "-c continue".
3725+
To let the script run until an exception occurs, use `-c continue`.
37263726
To let the script run up to a given line X in the debugged file, use
3727-
"-c 'until X'"."""
3727+
`-c 'until X'`."""
37283728

37293729

37303730
def exit_with_permission_help_text():

Lib/test/libregrtest/cmdline.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,73 +15,73 @@
1515
Run Python regression tests.
1616
1717
If no arguments or options are provided, finds all files matching
18-
the pattern "test_*" in the Lib/test subdirectory and runs
19-
them in alphabetical order (but see -M and -u, below, for exceptions).
18+
the pattern `test_*` in the `Lib/test` subdirectory and runs
19+
them in alphabetical order (but see `-M` and `-u`, below, for exceptions).
2020
2121
For more rigorous testing, it is useful to use the following
2222
command line:
2323
24-
python -E -Wd -m test [options] [test_name1 ...]
24+
`python -E -Wd -m test [options] [test_name1 ...]`
2525
"""
2626

2727
EPILOG = """\
2828
Additional option details:
2929
30-
-r randomizes test execution order. You can use --randseed=int to provide an
31-
int seed value for the randomizer. The randseed value will be used
30+
`-r` randomizes test execution order. You can use `--randseed=int` to provide an
31+
int seed value for the randomizer. The `randseed` value will be used
3232
to set seeds for all random usages in tests
33-
(including randomizing the tests order if -r is set).
33+
(including randomizing the tests order if `-r` is set).
3434
By default we always set random seed, but do not randomize test order.
3535
36-
-s On the first invocation of regrtest using -s, the first test file found
36+
`-s` On the first invocation of regrtest using `-s`, the first test file found
3737
or the first test file given on the command line is run, and the name of
38-
the next test is recorded in a file named pynexttest. If run from the
39-
Python build directory, pynexttest is located in the 'build' subdirectory,
40-
otherwise it is located in tempfile.gettempdir(). On subsequent runs,
41-
the test in pynexttest is run, and the next test is written to pynexttest.
42-
When the last test has been run, pynexttest is deleted. In this way it
38+
the next test is recorded in a file named `pynexttest`. If run from the
39+
Python build directory, `pynexttest` is located in the 'build' subdirectory,
40+
otherwise it is located in `tempfile.gettempdir()`. On subsequent runs,
41+
the test in `pynexttest` is run, and the next test is written to `pynexttest`.
42+
When the last test has been run, `pynexttest` is deleted. In this way it
4343
is possible to single step through the test files. This is useful when
4444
doing memory analysis on the Python interpreter, which process tends to
4545
consume too many resources to run the full regression test non-stop.
4646
47-
-S is used to resume running tests after an interrupted run. It will
48-
maintain the order a standard run (i.e. it assumes -r is not used).
47+
`-S` is used to resume running tests after an interrupted run. It will
48+
maintain the order a standard run (i.e. it assumes `-r` is not used).
4949
This is useful after the tests have prematurely stopped for some external
5050
reason and you want to resume the run from where you left off rather
51-
than starting from the beginning. Note: this is different from --prioritize.
51+
than starting from the beginning. Note: this is different from `--prioritize`.
5252
53-
--prioritize is used to influence the order of selected tests, such that
53+
`--prioritize` is used to influence the order of selected tests, such that
5454
the tests listed as an argument are executed first. This is especially
55-
useful when combined with -j and -r to pin the longest-running tests
56-
to start at the beginning of a test run. Pass --prioritize=test_a,test_b
57-
to make test_a run first, followed by test_b, and then the other tests.
58-
If test_a wasn't selected for execution by regular means, --prioritize will
55+
useful when combined with `-j` and `-r` to pin the longest-running tests
56+
to start at the beginning of a test run. Pass `--prioritize=test_a,test_b`
57+
to make `test_a` run first, followed by `test_b`, and then the other tests.
58+
If test_a wasn't selected for execution by regular means, `--prioritize` will
5959
not make it execute.
6060
61-
-f reads the names of tests from the file given as f's argument, one
61+
`-f` reads the names of tests from the file given as `f`'s argument, one
6262
or more test names per line. Whitespace is ignored. Blank lines and
63-
lines beginning with '#' are ignored. This is especially useful for
63+
lines beginning with `#` are ignored. This is especially useful for
6464
whittling down failures involving interactions among tests.
6565
66-
-L causes the leaks(1) command to be run just before exit if it exists.
67-
leaks(1) is available on Mac OS X and presumably on some other
66+
`-L` causes the leaks(1) command to be run just before exit if it exists.
67+
leaks(1) is available on macOS and presumably on some other
6868
FreeBSD-derived systems.
6969
70-
-R runs each test several times and examines sys.gettotalrefcount() to
70+
`-R` runs each test several times and examines `sys.gettotalrefcount()` to
7171
see if the test appears to be leaking references. The argument should
72-
be of the form stab:run:fname where 'stab' is the number of times the
73-
test is run to let gettotalrefcount settle down, 'run' is the number
74-
of times further it is run and 'fname' is the name of the file the
75-
reports are written to. These parameters all have defaults (5, 4 and
76-
"reflog.txt" respectively), and the minimal invocation is '-R :'.
72+
be of the form `stab:run:fname` where `stab` is the number of times the
73+
test is run to let gettotalrefcount settle down, `run` is the number
74+
of times further it is run and `fname` is the name of the file the
75+
reports are written to. These parameters all have defaults (`5`, `4` and
76+
`"reflog.txt"` respectively), and the minimal invocation is `-R :`.
7777
78-
-M runs tests that require an exorbitant amount of memory. These tests
78+
`-M` runs tests that require an exorbitant amount of memory. These tests
7979
typically try to ascertain containers keep working when containing more than
8080
2 billion objects, which only works on 64-bit systems. There are also some
8181
tests that try to exhaust the address space of the process, which only makes
8282
sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit,
83-
which is a string in the form of '2.5Gb', determines how much memory the
84-
tests will limit themselves to (but they may go slightly over.) The number
83+
which is a string in the form of `'2.5Gb'`, determines how much memory the
84+
tests will limit themselves to (but they may go slightly over). The number
8585
shouldn't be more memory than the machine has (including swap memory). You
8686
should also keep in mind that swap memory is generally much, much slower
8787
than RAM, and setting memlimit to all available RAM or higher will heavily
@@ -90,7 +90,7 @@
9090
to use more than memlimit memory will be skipped. The big-memory tests
9191
generally run very, very long.
9292
93-
-u is used to specify which special resource intensive tests to run,
93+
`-u` is used to specify which special resource intensive tests to run,
9494
such as those requiring large file support or network connectivity.
9595
The argument is a comma-separated list of words indicating the
9696
resources to test. Currently only the following are defined:
@@ -137,16 +137,16 @@
137137
wantobjects - Allows to run Tkinter tests with the specified value of
138138
tkinter.wantobjects.
139139
140-
To enable all resources except one, use '-uall,-<resource>'. For
141-
example, to run all the tests except for the gui tests, give the
142-
option '-uall,-gui'.
140+
To enable all resources except one, use `-uall,-<resource>`. For
141+
example, to run all the tests except for the `gui` tests, give the
142+
option `-uall,-gui`.
143143
144-
--matchfile filters tests using a text file, one pattern per line.
144+
`--matchfile` filters tests using a text file, one pattern per line.
145145
Pattern examples:
146146
147-
- test method: test_stat_attributes
148-
- test class: FileTests
149-
- test identifier: test_os.FileTests.test_stat_attributes
147+
- test method: `test_stat_attributes`
148+
- test class: `FileTests`
149+
- test identifier: `test_os.FileTests.test_stat_attributes`
150150
"""
151151

152152

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add backticks for colour to regrtest and pdb's help description. Patch by
2+
Hugo van Kemenade.

0 commit comments

Comments
 (0)