better name for hook

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-05-07 23:12:17 +02:00
parent 1e84a3c451
commit 4a70a667bb
3 changed files with 6 additions and 6 deletions

View File

@ -49,9 +49,9 @@ class PluginHooks:
def pytest_collect_directory(self, path, parent): def pytest_collect_directory(self, path, parent):
""" return Collection node or None. """ """ return Collection node or None. """
def pytest_pymodule_makeitem(self, modcol, name, obj): def pytest_pycollect_obj(self, collector, name, obj):
""" return custom item/collector for a python object in a module, or None. """ """ return custom item/collector for a python object in a module, or None. """
pytest_pymodule_makeitem.firstresult = True pytest_pycollect_obj.firstresult = True
def pytest_collectstart(self, collector): def pytest_collectstart(self, collector):
""" collector starts collecting. """ """ collector starts collecting. """

View File

@ -18,9 +18,9 @@ import py
class UnittestPlugin: class UnittestPlugin:
""" discover and integrate traditional ``unittest.py`` tests. """ discover and integrate traditional ``unittest.py`` tests.
""" """
def pytest_pymodule_makeitem(self, modcol, name, obj): def pytest_pycollect_obj(self, collector, name, obj):
if py.std.inspect.isclass(obj) and issubclass(obj, py.std.unittest.TestCase): if py.std.inspect.isclass(obj) and issubclass(obj, py.std.unittest.TestCase):
return UnitTestCase(name, parent=modcol) return UnitTestCase(name, parent=collector)
class UnitTestCase(py.test.collect.Class): class UnitTestCase(py.test.collect.Class):
def collect(self): def collect(self):

View File

@ -135,8 +135,8 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector):
return self.join(name) return self.join(name)
def makeitem(self, name, obj): def makeitem(self, name, obj):
res = self.config.hook.pytest_pymodule_makeitem( res = self.config.hook.pytest_pycollect_obj(
modcol=self, name=name, obj=obj) collector=self, name=name, obj=obj)
if res: if res:
return res return res
if (self.classnamefilter(name)) and \ if (self.classnamefilter(name)) and \