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

Function parse_override_ini

src/_pytest/config/findpaths.py:253–272  ·  view source on GitHub ↗

Parse the -o/--override-ini command line arguments and return the overrides. :raises UsageError: If one of the values is malformed.

(override_ini: Sequence[str] | None)

Source from the content-addressed store, hash-verified

251
252
253def parse_override_ini(override_ini: Sequence[str] | None) -> ConfigDict:
254 """Parse the -o/--override-ini command line arguments and return the overrides.
255
256 :raises UsageError:
257 If one of the values is malformed.
258 """
259 overrides = {}
260 # override_ini is a list of "ini=value" options.
261 # Always use the last item if multiple values are set for same ini-name,
262 # e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2.
263 for ini_config in override_ini or ():
264 try:
265 key, user_ini_value = ini_config.split("=", 1)
266 except ValueError as e:
267 raise UsageError(
268 f"-o/--override-ini expects option=value style (got: {ini_config!r})."
269 ) from e
270 else:
271 overrides[key] = ConfigValue(user_ini_value, origin="override", mode="ini")
272 return overrides
273
274
275CFG_PYTEST_SECTION = "[pytest] section in {filename} files is no longer supported, change to [tool:pytest] instead."

Callers 2

parseMethod · 0.85
determine_setupFunction · 0.85

Calls 2

UsageErrorClass · 0.85
ConfigValueClass · 0.85

Tested by

no test coverage detected