allow unregistration by name
This commit is contained in:
parent
32ac7a7c6e
commit
53d1cfc3a1
|
@ -5,7 +5,7 @@ see http://pytest.org for documentation and details
|
|||
|
||||
(c) Holger Krekel and others, 2004-2010
|
||||
"""
|
||||
__version__ = '2.0.0.dev16'
|
||||
__version__ = '2.0.0.dev17'
|
||||
|
||||
__all__ = ['config', 'cmdline']
|
||||
|
||||
|
|
|
@ -47,9 +47,11 @@ class PluginManager(object):
|
|||
self._plugins.insert(0, plugin)
|
||||
return True
|
||||
|
||||
def unregister(self, plugin):
|
||||
self.hook.pytest_plugin_unregistered(plugin=plugin)
|
||||
def unregister(self, plugin=None, name=None):
|
||||
if plugin is None:
|
||||
plugin = self.getplugin(name=name)
|
||||
self._plugins.remove(plugin)
|
||||
self.hook.pytest_plugin_unregistered(plugin=plugin)
|
||||
for name, value in list(self._name2plugin.items()):
|
||||
if value == plugin:
|
||||
del self._name2plugin[name]
|
||||
|
|
2
setup.py
2
setup.py
|
@ -22,7 +22,7 @@ def main():
|
|||
name='pytest',
|
||||
description='py.test: simple powerful testing with Python',
|
||||
long_description = long_description,
|
||||
version='2.0.0.dev16',
|
||||
version='2.0.0.dev17',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
|
|
@ -164,7 +164,7 @@ class TestBootstrapping:
|
|||
assert pp.getplugin('hello') == a2
|
||||
pp.unregister(a1)
|
||||
assert not pp.isregistered(a1)
|
||||
pp.unregister(a2)
|
||||
pp.unregister(name="hello")
|
||||
assert not pp.isregistered(a2)
|
||||
|
||||
def test_pm_ordering(self):
|
||||
|
|
Loading…
Reference in New Issue