@@ -119,16 +119,13 @@ def __init__(self):
119119
120120 def register (self , plugin , name = None , conftest = False ):
121121 ret = super (PytestPluginManager , self ).register (plugin , name )
122- if ret and not conftest :
123- self ._globalplugins .append (plugin )
122+ if ret :
123+ if not conftest :
124+ self ._globalplugins .append (plugin )
125+ if hasattr (self , "config" ):
126+ self .config ._register_plugin (plugin , name )
124127 return ret
125128
126- def _do_register (self , plugin , name ):
127- # called from core PluginManager class
128- if hasattr (self , "config" ):
129- self .config ._register_plugin (plugin , name )
130- return super (PytestPluginManager , self )._do_register (plugin , name )
131-
132129 def unregister (self , plugin ):
133130 super (PytestPluginManager , self ).unregister (plugin )
134131 try :
@@ -710,8 +707,7 @@ def __init__(self, pluginmanager):
710707
711708 def _register_plugin (self , plugin , name ):
712709 call_plugin = self .pluginmanager .call_plugin
713- call_plugin (plugin , "pytest_addhooks" ,
714- {'pluginmanager' : self .pluginmanager })
710+ call_plugin (plugin , "pytest_addhooks" , {'pluginmanager' : self .pluginmanager })
715711 self .hook .pytest_plugin_registered (plugin = plugin ,
716712 manager = self .pluginmanager )
717713 dic = call_plugin (plugin , "pytest_namespace" , {}) or {}
0 commit comments