Skip to content

Commit 60173b5

Browse files
committed
Move CLI options to correct help section
Before: pytest-warnings: -W, --pythonwarnings PYTHONWARNINGS Set which warnings to report, see -W option of Python itself --maxfail=num Exit after first num failures or errors --strict-config Any warnings encountered while parsing the `pytest` section of the configuration file raise errors --strict-markers Markers not registered in the `markers` section of the configuration file raise errors --strict (Deprecated) alias to --strict-markers -c, --config-file FILE Load configuration from `FILE` instead of trying to locate one of the implicit configuration files. --continue-on-collection-errors Force test execution even if collection errors occur --rootdir=ROOTDIR Define root directory for tests. Can be relative path: 'root_dir', './root_dir', 'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables: '$HOME/root_dir'. But other than -W, those options aren't related to pytest-warnings at all. This is a regression in 19e99ab, which added `group = parser.getgroup("pytest-warnings")` in the middle of those "general" options, thus moving the help section for some of them.
1 parent 62aa427 commit 60173b5

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/_pytest/main.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,6 @@ def pytest_addoption(parser: Parser) -> None:
9292
const=1,
9393
help="Exit instantly on first error or failed test",
9494
)
95-
group = parser.getgroup("pytest-warnings")
96-
group.addoption(
97-
"-W",
98-
"--pythonwarnings",
99-
action="append",
100-
help="Set which warnings to report, see -W option of Python itself",
101-
)
102-
parser.addini(
103-
"filterwarnings",
104-
type="linelist",
105-
help="Each line specifies a pattern for "
106-
"warnings.filterwarnings. "
107-
"Processed after -W/--pythonwarnings.",
108-
)
10995
group._addoption(
11096
"--maxfail",
11197
metavar="num",
@@ -157,6 +143,21 @@ def pytest_addoption(parser: Parser) -> None:
157143
"'$HOME/root_dir'.",
158144
)
159145

146+
group = parser.getgroup("pytest-warnings")
147+
group.addoption(
148+
"-W",
149+
"--pythonwarnings",
150+
action="append",
151+
help="Set which warnings to report, see -W option of Python itself",
152+
)
153+
parser.addini(
154+
"filterwarnings",
155+
type="linelist",
156+
help="Each line specifies a pattern for "
157+
"warnings.filterwarnings. "
158+
"Processed after -W/--pythonwarnings.",
159+
)
160+
160161
group = parser.getgroup("collect", "collection")
161162
group.addoption(
162163
"--collectonly",

0 commit comments

Comments
 (0)