MCPcopy
hub / github.com/pytest-dev/pytest / pytest_addoption

Function pytest_addoption

src/_pytest/logging.py:235–332  ·  view source on GitHub ↗

Add options to control log capturing.

(parser: Parser)

Source from the content-addressed store, hash-verified

233
234
235def pytest_addoption(parser: Parser) -> None:
236 """Add options to control log capturing."""
237 group = parser.getgroup("logging")
238
239 def add_option_ini(option, dest, default=None, type=None, **kwargs):
240 parser.addini(
241 dest, default=default, type=type, help="Default value for " + option
242 )
243 group.addoption(option, dest=dest, **kwargs)
244
245 add_option_ini(
246 "--log-level",
247 dest="log_level",
248 default=None,
249 metavar="LEVEL",
250 help=(
251 "Level of messages to catch/display."
252 " Not set by default, so it depends on the root/parent log handler's"
253 ' effective level, where it is "WARNING" by default.'
254 ),
255 )
256 add_option_ini(
257 "--log-format",
258 dest="log_format",
259 default=DEFAULT_LOG_FORMAT,
260 help="Log format used by the logging module",
261 )
262 add_option_ini(
263 "--log-date-format",
264 dest="log_date_format",
265 default=DEFAULT_LOG_DATE_FORMAT,
266 help="Log date format used by the logging module",
267 )
268 parser.addini(
269 "log_cli",
270 default=False,
271 type="bool",
272 help='Enable log display during test run (also known as "live logging")',
273 )
274 add_option_ini(
275 "--log-cli-level", dest="log_cli_level", default=None, help="CLI logging level"
276 )
277 add_option_ini(
278 "--log-cli-format",
279 dest="log_cli_format",
280 default=None,
281 help="Log format used by the logging module",
282 )
283 add_option_ini(
284 "--log-cli-date-format",
285 dest="log_cli_date_format",
286 default=None,
287 help="Log date format used by the logging module",
288 )
289 add_option_ini(
290 "--log-file",
291 dest="log_file",
292 default=None,

Callers

nothing calls this directly

Calls 4

add_option_iniFunction · 0.85
getgroupMethod · 0.80
addiniMethod · 0.80
addoptionMethod · 0.45

Tested by

no test coverage detected