[py-svn] pytest commit 7d2db9cfe921: allow unregistration by name

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Nov 1 09:20:02 CET 2010


# HG changeset patch -- Bitbucket.org
# Project pytest
# URL http://bitbucket.org/hpk42/pytest/overview
# User holger krekel <holger at merlinux.eu>
# Date 1288599658 -3600
# Node ID 7d2db9cfe9216159f9b41347e659fffca6095564
# Parent  37e6a9570c348624983020109d83287e0b37ddf7
allow unregistration by name

--- a/setup.py
+++ b/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'],

--- a/testing/test_pluginmanager.py
+++ b/testing/test_pluginmanager.py
@@ -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):

--- a/pytest/_core.py
+++ b/pytest/_core.py
@@ -47,9 +47,11 @@ class PluginManager(object):
             self._plugins.insert(0, plugin)
         return True
 
-    def unregister(self, 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)
-        self._plugins.remove(plugin)
         for name, value in list(self._name2plugin.items()):
             if value == plugin:
                 del self._name2plugin[name]

--- a/pytest/__init__.py
+++ b/pytest/__init__.py
@@ -5,7 +5,7 @@ see http://pytest.org for documentation 
 
 (c) Holger Krekel and others, 2004-2010
 """
-__version__ = '2.0.0.dev16'
+__version__ = '2.0.0.dev17'
 
 __all__ = ['config', 'cmdline']



More information about the pytest-commit mailing list