[svn r40702] (pedronis, arigo)

Add setup/teardown calls around generators, with the same semantics as
around functions and methods.

--HG--
branch : trunk
This commit is contained in:
arigo
2007-03-18 16:59:45 +01:00
parent 1b639695b4
commit 5506b03f81
3 changed files with 47 additions and 37 deletions

View File

@@ -442,7 +442,9 @@ class Instance(PyCollectorMixin, Collector):
Collector.Function.__get__(self)) # XXX for python 2.2
Function = property(Function)
class Generator(PyCollectorMixin, Collector):
from py.__.test.item import FunctionMixin # XXX import order issues :-(
class Generator(FunctionMixin, PyCollectorMixin, Collector):
def run(self):
self._prepare()
itemlist = self._name2items
@@ -468,13 +470,6 @@ class Generator(PyCollectorMixin, Collector):
call, args = obj, ()
return call, args
def _getpathlineno(self):
code = py.code.Code(self.obj)
return code.path, code.firstlineno
def _getsortvalue(self):
return self._getpathlineno()
class DoctestFile(PyCollectorMixin, FSCollector):
def run(self):
return [self.fspath.basename]