Touchup pre-PR

This commit is contained in:
Gleb Nikonorov 2020-06-06 11:05:32 -04:00
parent 2a3c21645e
commit f760b105ef
3 changed files with 15 additions and 15 deletions

View File

@ -0,0 +1,3 @@
A new INI key `require_plugins` has been added that allows the user to specify a list of plugins required for pytest to run.
The `--strict-config` flag can be used to treat these warnings as errors.

View File

@ -1561,6 +1561,18 @@ passed multiple times. The expected format is ``name=value``. For example::
See :ref:`change naming conventions` for more detailed examples.
.. confval:: require_plugins
A space separated list of plugins that must be present for pytest to run.
If any one of the plugins is not found, emit a warning.
If pytest is run with ``--strict-config`` exceptions are raised in place of warnings.
.. code-block:: ini
[pytest]
require_plugins = pluginA pluginB pluginC
.. confval:: testpaths
@ -1604,13 +1616,3 @@ passed multiple times. The expected format is ``name=value``. For example::
[pytest]
xfail_strict = True
.. confval:: required_plugins
A space seperated list of plugins that must be present for pytest to run
.. code-block:: ini
[pytest]
require_plugins = pluginA pluginB pluginC

View File

@ -1090,11 +1090,6 @@ class Config:
self._emit_warning_or_fail("Unknown config ini key: {}\n".format(key))
def _validate_plugins(self) -> None:
# so iterate over all required plugins and see if pluginmanager hasplugin
# NOTE: This also account for -p no:<plugin> ( e.g: -p no:celery )
# raise ValueError(self._parser._inidict['requiredplugins'])
# raise ValueError(self.getini("requiredplugins"))
# raise ValueError(self.pluginmanager.hasplugin('debugging'))
for plugin in self.getini("require_plugins"):
if not self.pluginmanager.hasplugin(plugin):
self._emit_warning_or_fail(