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

Method parseconfig

src/_pytest/pytester.py:1234–1255  ·  view source on GitHub ↗

Return a new pytest :class:`pytest.Config` instance from given commandline args. This invokes the pytest bootstrapping code in _pytest.config to create a new :py:class:`pytest.PytestPluginManager` and call the :hook:`pytest_cmdline_parse` hook to create a new :class:

(self, *args: str | os.PathLike[str])

Source from the content-addressed store, hash-verified

1232 return new_args
1233
1234 def parseconfig(self, *args: str | os.PathLike[str]) -> Config:
1235 """Return a new pytest :class:`pytest.Config` instance from given
1236 commandline args.
1237
1238 This invokes the pytest bootstrapping code in _pytest.config to create a
1239 new :py:class:`pytest.PytestPluginManager` and call the
1240 :hook:`pytest_cmdline_parse` hook to create a new :class:`pytest.Config`
1241 instance.
1242
1243 If :attr:`plugins` has been populated they should be plugin modules
1244 to be registered with the plugin manager.
1245 """
1246 import _pytest.config
1247
1248 new_args = [str(x) for x in self._ensure_basetemp(args)]
1249
1250 config = _pytest.config._prepareconfig(new_args, self.plugins)
1251 # we don't know what the test will do with this half-setup config
1252 # object and thus we make sure it gets unconfigured properly in any
1253 # case (otherwise capturing could still be active, for example)
1254 self._request.addfinalizer(config._ensure_unconfigure)
1255 return config
1256
1257 def parseconfigure(self, *args: str | os.PathLike[str]) -> Config:
1258 """Return a new pytest configured Config instance.

Callers 15

parseconfigureMethod · 0.95
test_rewriteMethod · 0.45
test_isattyMethod · 0.45
test_gitignoreFunction · 0.45
test_preserve_keys_orderFunction · 0.45
test_cachedir_tagFunction · 0.45
test_parseconfigFunction · 0.45
test_ini_namesMethod · 0.45

Calls 2

_ensure_basetempMethod · 0.95
addfinalizerMethod · 0.45

Tested by

no test coverage detected