Skip to content

Commit e54c6a1

Browse files
authored
Document the --code-highlight default (#9883)
Also normalized all help text using the patterns: * `One sentence help text` * `First sentence of help. Second sentence of help.`
1 parent 9a8f5dd commit e54c6a1

28 files changed

+279
-272
lines changed

changelog/9883.improvement.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Normalize the help description of all command-line options.

doc/en/reference/reference.rst

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

src/_pytest/assertion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def pytest_addoption(parser: Parser) -> None:
3939
"enable_assertion_pass_hook",
4040
type="bool",
4141
default=False,
42-
help="Enables the pytest_assertion_pass hook."
42+
help="Enables the pytest_assertion_pass hook. "
4343
"Make sure to delete any previously generated pyc cache files.",
4444
)
4545

src/_pytest/cacheprovider.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,15 @@ def pytest_addoption(parser: Parser) -> None:
440440
"--last-failed",
441441
action="store_true",
442442
dest="lf",
443-
help="rerun only the tests that failed "
443+
help="Rerun only the tests that failed "
444444
"at the last run (or all if none failed)",
445445
)
446446
group.addoption(
447447
"--ff",
448448
"--failed-first",
449449
action="store_true",
450450
dest="failedfirst",
451-
help="run all tests, but run the last failures first.\n"
451+
help="Run all tests, but run the last failures first. "
452452
"This may re-order tests and thus lead to "
453453
"repeated fixture setup/teardown.",
454454
)
@@ -457,7 +457,7 @@ def pytest_addoption(parser: Parser) -> None:
457457
"--new-first",
458458
action="store_true",
459459
dest="newfirst",
460-
help="run tests from new files first, then the rest of the tests "
460+
help="Run tests from new files first, then the rest of the tests "
461461
"sorted by file mtime",
462462
)
463463
group.addoption(
@@ -466,28 +466,28 @@ def pytest_addoption(parser: Parser) -> None:
466466
nargs="?",
467467
dest="cacheshow",
468468
help=(
469-
"show cache contents, don't perform collection or tests. "
469+
"Show cache contents, don't perform collection or tests. "
470470
"Optional argument: glob (default: '*')."
471471
),
472472
)
473473
group.addoption(
474474
"--cache-clear",
475475
action="store_true",
476476
dest="cacheclear",
477-
help="remove all cache contents at start of test run.",
477+
help="Remove all cache contents at start of test run",
478478
)
479479
cache_dir_default = ".pytest_cache"
480480
if "TOX_ENV_DIR" in os.environ:
481481
cache_dir_default = os.path.join(os.environ["TOX_ENV_DIR"], cache_dir_default)
482-
parser.addini("cache_dir", default=cache_dir_default, help="cache directory path.")
482+
parser.addini("cache_dir", default=cache_dir_default, help="Cache directory path")
483483
group.addoption(
484484
"--lfnf",
485485
"--last-failed-no-failures",
486486
action="store",
487487
dest="last_failed_no_failures",
488488
choices=("all", "none"),
489489
default="all",
490-
help="which tests to run with no previously (known) failures.",
490+
help="Which tests to run with no previously (known) failures",
491491
)
492492

493493

src/_pytest/capture.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def pytest_addoption(parser: Parser) -> None:
4242
default="fd",
4343
metavar="method",
4444
choices=["fd", "sys", "no", "tee-sys"],
45-
help="per-test capturing method: one of fd|sys|no|tee-sys.",
45+
help="Per-test capturing method: one of fd|sys|no|tee-sys",
4646
)
4747
group._addoption(
4848
"-s",
4949
action="store_const",
5050
const="no",
5151
dest="capture",
52-
help="shortcut for --capture=no.",
52+
help="Shortcut for --capture=no",
5353
)
5454

5555

src/_pytest/config/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,11 +1115,11 @@ def _initini(self, args: Sequence[str]) -> None:
11151115
self.inicfg = inicfg
11161116
self._parser.extra_info["rootdir"] = str(self.rootpath)
11171117
self._parser.extra_info["inifile"] = str(self.inipath)
1118-
self._parser.addini("addopts", "extra command line options", "args")
1119-
self._parser.addini("minversion", "minimally required pytest version")
1118+
self._parser.addini("addopts", "Extra command line options", "args")
1119+
self._parser.addini("minversion", "Minimally required pytest version")
11201120
self._parser.addini(
11211121
"required_plugins",
1122-
"plugins that must be present for pytest to run",
1122+
"Plugins that must be present for pytest to run",
11231123
type="args",
11241124
default=[],
11251125
)

src/_pytest/config/argparsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(
4848
_ispytest: bool = False,
4949
) -> None:
5050
check_ispytest(_ispytest)
51-
self._anonymous = OptionGroup("custom options", parser=self, _ispytest=True)
51+
self._anonymous = OptionGroup("Custom options", parser=self, _ispytest=True)
5252
self._groups: List[OptionGroup] = []
5353
self._processopt = processopt
5454
self._usage = usage

src/_pytest/debugging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ def pytest_addoption(parser: Parser) -> None:
4646
"--pdb",
4747
dest="usepdb",
4848
action="store_true",
49-
help="start the interactive Python debugger on errors or KeyboardInterrupt.",
49+
help="Start the interactive Python debugger on errors or KeyboardInterrupt",
5050
)
5151
group._addoption(
5252
"--pdbcls",
5353
dest="usepdb_cls",
5454
metavar="modulename:classname",
5555
type=_validate_usepdb_cls,
56-
help="specify a custom interactive Python debugger for use with --pdb."
56+
help="Specify a custom interactive Python debugger for use with --pdb."
5757
"For example: --pdbcls=IPython.terminal.debugger:TerminalPdb",
5858
)
5959
group._addoption(
6060
"--trace",
6161
dest="trace",
6262
action="store_true",
63-
help="Immediately break when running each test.",
63+
help="Immediately break when running each test",
6464
)
6565

6666

src/_pytest/doctest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,26 @@
6666
def pytest_addoption(parser: Parser) -> None:
6767
parser.addini(
6868
"doctest_optionflags",
69-
"option flags for doctests",
69+
"Option flags for doctests",
7070
type="args",
7171
default=["ELLIPSIS"],
7272
)
7373
parser.addini(
74-
"doctest_encoding", "encoding used for doctest files", default="utf-8"
74+
"doctest_encoding", "Encoding used for doctest files", default="utf-8"
7575
)
7676
group = parser.getgroup("collect")
7777
group.addoption(
7878
"--doctest-modules",
7979
action="store_true",
8080
default=False,
81-
help="run doctests in all .py modules",
81+
help="Run doctests in all .py modules",
8282
dest="doctestmodules",
8383
)
8484
group.addoption(
8585
"--doctest-report",
8686
type=str.lower,
8787
default="udiff",
88-
help="choose another output format for diffs on doctest failure",
88+
help="Choose another output format for diffs on doctest failure",
8989
choices=DOCTEST_REPORT_CHOICES,
9090
dest="doctestreport",
9191
)
@@ -94,21 +94,21 @@ def pytest_addoption(parser: Parser) -> None:
9494
action="append",
9595
default=[],
9696
metavar="pat",
97-
help="doctests file matching pattern, default: test*.txt",
97+
help="Doctests file matching pattern, default: test*.txt",
9898
dest="doctestglob",
9999
)
100100
group.addoption(
101101
"--doctest-ignore-import-errors",
102102
action="store_true",
103103
default=False,
104-
help="ignore doctest ImportErrors",
104+
help="Ignore doctest ImportErrors",
105105
dest="doctest_ignore_import_errors",
106106
)
107107
group.addoption(
108108
"--doctest-continue-on-failure",
109109
action="store_true",
110110
default=False,
111-
help="for a given doctest, continue to run after the first failure",
111+
help="For a given doctest, continue to run after the first failure",
112112
dest="doctest_continue_on_failure",
113113
)
114114

src/_pytest/faulthandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def pytest_addoption(parser: Parser) -> None:
1919
help = (
2020
"Dump the traceback of all threads if a test takes "
21-
"more than TIMEOUT seconds to finish."
21+
"more than TIMEOUT seconds to finish"
2222
)
2323
parser.addini("faulthandler_timeout", help, default=0.0)
2424

0 commit comments

Comments
 (0)