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

Method getini

src/_pytest/config/__init__.py:1676–1712  ·  src/_pytest/config/__init__.py::Config.getini

Return configuration value the an :ref:`configuration file <configfiles>`. If a configuration value is not defined in a :ref:`configuration file <configfiles>`, then the ``default`` value provided while registering the configuration through :func:`parser.addini <pyte

(self, name: str)

Source from the content-addressed store, hash-verified

1674 x.append(line) class="cm"># modifies the cached list inline
1675
1676 def getini(self, name: str) -> Any:
1677 class="st">"""Return configuration value the an :ref:`configuration file <configfiles>`.
1678
1679 If a configuration value is not defined in a
1680 :ref:`configuration file <configfiles>`, then the ``default`` value
1681 provided while registering the configuration through
1682 :func:`parser.addini <pytest.Parser.addini>` will be returned.
1683 Please note that you can even provide ``None`` as a valid
1684 default value.
1685
1686 If ``default`` is not provided while registering using
1687 :func:`parser.addini <pytest.Parser.addini>`, then a default value
1688 based on the ``type`` parameter passed to
1689 :func:`parser.addini <pytest.Parser.addini>` will be returned.
1690 The default values based on ``type`` are:
1691 ``paths``, ``pathlist``, ``args`` and ``linelist`` : empty list ``[]``
1692 ``bool`` : ``False``
1693 ``string`` : empty string ``class="st">""``
1694 ``int`` : ``0``
1695 ``float`` : ``0.0``
1696
1697 If neither the ``default`` nor the ``type`` parameter is passed
1698 while registering the configuration through
1699 :func:`parser.addini <pytest.Parser.addini>`, then the configuration
1700 is treated as a string and a default empty string &class="cm">#x27;' is returned.
1701
1702 If the specified name hasn&class="cm">#x27;t been registered through a prior
1703 :func:`parser.addini <pytest.Parser.addini>` call (usually from a
1704 plugin), a ValueError is raised.
1705 class="st">"""
1706 canonical_name = self._parser._ini_aliases.get(name, name)
1707 try:
1708 return self._inicache[canonical_name]
1709 except KeyError:
1710 pass
1711 self._inicache[canonical_name] = val = self._getini(canonical_name)
1712 return val
1713
1714 class="cm"># Meant for easy monkeypatching by legacypath plugin.
1715 class="cm"># Can be inlined back (with no cover removed) once legacypath is gone.

Callers 15

_checkversionMethod · 0.95
_validate_pluginsMethod · 0.95
parseMethod · 0.95
addinivalue_lineMethod · 0.95
get_verbosityMethod · 0.95
pytest_configureFunction · 0.45
get_option_iniFunction · 0.45

Calls 2

_getiniMethod · 0.95
getMethod · 0.45

Tested by 3

copy_exampleMethod · 0.36
get_optionflagsFunction · 0.36
collectMethod · 0.36