Merge pull request #933 from nicoddemus/hasplugin

Reintroduce hasplugin to PytestPluginManager
This commit is contained in:
Ronny Pfannschmidt 2015-08-10 09:40:52 +02:00
commit bc509b42e8
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