From 6843c64a95ad4fe9472125c5e832e14681a9bd99 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 12 May 2009 11:29:14 +0200 Subject: [PATCH] avoid superflous methods --HG-- branch : trunk --- py/test/funcargs.py | 4 ++-- py/test/pycollect.py | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/py/test/funcargs.py b/py/test/funcargs.py index 7ebdcd331..016f764e9 100644 --- a/py/test/funcargs.py +++ b/py/test/funcargs.py @@ -80,12 +80,12 @@ class FuncargRequest: self._pyfuncitem = pyfuncitem self.argname = argname self.function = pyfuncitem.obj - self.module = pyfuncitem.getmodulecollector().obj + self.module = pyfuncitem._getparent(py.test.collect.Module).obj self.cls = getattr(self.function, 'im_class', None) self.config = pyfuncitem.config self.fspath = pyfuncitem.fspath self._plugins = self.config.pluginmanager.getplugins() - self._plugins.append(pyfuncitem.getmodulecollector().obj) + self._plugins.append(self.module) self._provider = self.config.pluginmanager.listattr( plugins=self._plugins, attrname=self._argprefix + str(argname) diff --git a/py/test/pycollect.py b/py/test/pycollect.py index 4c60a4a9b..ab2740c8a 100644 --- a/py/test/pycollect.py +++ b/py/test/pycollect.py @@ -38,10 +38,6 @@ class PyobjMixin(object): def _getobj(self): return getattr(self.parent.obj, self.name) - def getmodulecollector(self): - return self._getparent(Module) - def getclasscollector(self): - return self._getparent(Class) def _getparent(self, cls): current = self while current and not isinstance(current, cls): @@ -167,10 +163,10 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector): return self._genfunctions(name, obj) def _genfunctions(self, name, funcobj): - module = self.getmodulecollector().obj + module = self._getparent(Module).obj # due to _buildname2items funcobj is the raw function, we need # to work to get at the class - clscol = self.getclasscollector() + clscol = self._getparent(Class) cls = clscol and clscol.obj or None funcspec = funcargs.FuncSpecs(funcobj, config=self.config, cls=cls, module=module) gentesthook = self.config.hook.pytest_genfunc.clone(extralookup=module)