Reintroduce hasplugin to PytestPluginManager

Fix #932
This commit is contained in:
Bruno Oliveira 2015-08-09 19:30:49 -03:00
parent 1c680210c2
commit e103932aad
2 changed files with 9 additions and 0 deletions

View File

@ -211,6 +211,10 @@ class PytestPluginManager(PluginManager):
# support deprecated naming because plugins (xdist e.g.) use it
return self.get_plugin(name)
def hasplugin(self, name):
"""Return True if the plugin with the given name is registered."""
return bool(self.get_plugin(name))
def pytest_configure(self, config):
# XXX now that the pluginmanager exposes hookimpl(tryfirst...)
# we should remove tryfirst/trylast as markers

View File

@ -586,6 +586,11 @@ class TestInvocationVariants:
assert type(_pytest.config.get_plugin_manager()) is _pytest.config.PytestPluginManager
def test_has_plugin(self, request):
"""Test hasplugin function of the plugin manager (#932)."""
assert request.config.pluginmanager.hasplugin('python')
class TestDurations:
source = """
import time