Merge pull request #933 from nicoddemus/hasplugin
Reintroduce hasplugin to PytestPluginManager
This commit is contained in:
commit
bc509b42e8
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue