parent
							
								
									c2415d7eee
								
							
						
					
					
						commit
						6956d1a7e4
					
				| 
						 | 
					@ -53,12 +53,12 @@ class PluginManager(object):
 | 
				
			||||||
    def getplugins(self):
 | 
					    def getplugins(self):
 | 
				
			||||||
        return list(self.comregistry)
 | 
					        return list(self.comregistry)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # API for bootstrapping 
 | 
					 | 
				
			||||||
    #
 | 
					 | 
				
			||||||
    def getplugin(self, importname):
 | 
					    def getplugin(self, importname):
 | 
				
			||||||
        impname = canonical_importname(importname)
 | 
					        impname = canonical_importname(importname)
 | 
				
			||||||
        return self.impname2plugin[impname]
 | 
					        return self.impname2plugin[impname]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # API for bootstrapping 
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
    def _envlist(self, varname):
 | 
					    def _envlist(self, varname):
 | 
				
			||||||
        val = py.std.os.environ.get(varname, None)
 | 
					        val = py.std.os.environ.get(varname, None)
 | 
				
			||||||
        if val is not None:
 | 
					        if val is not None:
 | 
				
			||||||
| 
						 | 
					@ -144,10 +144,6 @@ class PluginManager(object):
 | 
				
			||||||
    # API for interacting with registered and instantiated plugin objects 
 | 
					    # API for interacting with registered and instantiated plugin objects 
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    # 
 | 
					    # 
 | 
				
			||||||
    def getfirst(self, attrname):
 | 
					 | 
				
			||||||
        for x in self.comregistry.listattr(attrname):
 | 
					 | 
				
			||||||
            return x
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def listattr(self, attrname, plugins=None, extra=()):
 | 
					    def listattr(self, attrname, plugins=None, extra=()):
 | 
				
			||||||
        return self.comregistry.listattr(attrname, plugins=plugins, extra=extra)
 | 
					        return self.comregistry.listattr(attrname, plugins=plugins, extra=extra)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -197,15 +197,6 @@ class TestPytestPluginInteractions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # lower level API
 | 
					    # lower level API
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_getfirst(self):
 | 
					 | 
				
			||||||
        pluginmanager = PluginManager()
 | 
					 | 
				
			||||||
        class My1:
 | 
					 | 
				
			||||||
            x = 1
 | 
					 | 
				
			||||||
        assert pluginmanager.getfirst("x") is None
 | 
					 | 
				
			||||||
        pluginmanager.register(My1())
 | 
					 | 
				
			||||||
        assert pluginmanager.getfirst("x") == 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def test_listattr(self):
 | 
					    def test_listattr(self):
 | 
				
			||||||
        pluginmanager = PluginManager()
 | 
					        pluginmanager = PluginManager()
 | 
				
			||||||
        class My2:
 | 
					        class My2:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue