/home/johnny/projects/merlinux/py/dist/py/test/collect.py:339
def makeitem(self, name, obj, usefilters=True):
if (not usefilters or self.classnamefilter(name)) and isclass(obj):
return self.Class(name, parent=self)
-> elif (not usefilters or self.funcnamefilter(name)) and callable(obj):
if obj.func_code.co_flags & 32: # generator function
return self.Generator(name, parent=self)
else:
return self.Function(name, parent=self)
/home/johnny/projects/merlinux/py/dist/py/test/collect.py:331
def buildname2items(self):
# NB. we avoid random getattrs and peek in the __dict__ instead
d = {}
dicts = [getattr(self.obj, '__dict__', {})]
for basecls in py.std.inspect.getmro(self.obj.__class__):
dicts.append(basecls.__dict__)
seen = {}
for dic in dicts:
for name, obj in dic.items():
if name in seen:
continue
seen[name] = True
-> res = self.makeitem(name, obj)
if res is not None:
d[name] = res
return d
/home/johnny/projects/merlinux/py/dist/py/test/collect.py:240
def _prepare(self):
if not hasattr(self, '_name2items'):
ex = getattr(self, '_name2items_exception', None)
if ex is not None:
raise ex[0], ex[1], ex[2]
try:
-> self._name2items = self.buildname2items()
except (SystemExit, KeyboardInterrupt):
raise
except:
self._name2items_exception = py.std.sys.exc_info()
raise
/home/johnny/projects/merlinux/py/dist/py/test/collect.py:254
def run(self):
-> self._prepare()
itemlist = self._name2items.values()
itemlist.sort()
return [x.name for x in itemlist]
/home/johnny/projects/merlinux/py/dist/py/test/testing/test_collect.py:167
def test_generative_simple():
o = tmpdir.ensure('generativetest', dir=1)
tfile = o.join('test_generative.py')
tfile.write(py.code.Source("""
from __future__ import generators # python2.2!
def func1(arg, arg2):
assert arg == arg2
def test_gen():
yield func1, 17, 3*5
yield func1, 42, 6*7
class TestGenMethods:
def test_gen(self):
yield func1, 17, 3*5
yield func1, 42, 6*7
"""))
col = py.test.collect.Module(tfile)
l = col.run()
assert len(l) == 2
l = col.multijoin(l)
generator = l[0]
assert isinstance(generator, py.test.collect.Generator)
l2 = generator.run()
assert len(l2) == 2
l2 = generator.multijoin(l2)
assert isinstance(l2[0], py.test.Function)
assert isinstance(l2[1], py.test.Function)
assert l2[0].name == '[0]'
assert l2[1].name == '[1]'
assert l2[0].obj.func_name == 'func1'
classlist = l[1].run()
assert len(classlist) == 1
classlist = l[1].multijoin(classlist)
cls = classlist[0]
-> generator = cls.join(cls.run()[0])
assert isinstance(generator, py.test.collect.Generator)
l2 = generator.run()
assert len(l2) == 2
l2 = generator.multijoin(l2)
assert isinstance(l2[0], py.test.Function)
assert isinstance(l2[1], py.test.Function)
assert l2[0].name == '[0]'
assert l2[1].name == '[1]'
/home/johnny/projects/merlinux/py/dist/py/test/item.py:79
def execute(self, target, *args):
""" default implementation for calling a test target is to
simply call it.
"""
-> target(*args)
/home/johnny/projects/merlinux/py/dist/py/test/item.py:73
def run(self):
self.state.prepare(self)
-> self.execute(self.obj, *self.args)
/home/johnny/projects/merlinux/py/dist/py/test/rsession/executor.py:22
def execute(self):
try:
-> self.item.run()
outcome = Outcome()
except py.test.Item.Skipped, e:
outcome = Outcome(skipped=str(e))
except (KeyboardInterrupt, SystemExit):
raise
except:
excinfo = py.code.ExceptionInfo()
if isinstance(self.item, py.test.Function):
fun = self.item.obj # hope this is stable
code = py.code.Code(fun)
excinfo.traceback = excinfo.traceback.cut(
path=code.path, firstlineno=code.firstlineno)
outcome = Outcome(excinfo=excinfo, setupfailure=False)
if self.usepdb:
if self.reporter is not None:
self.reporter(report.ImmediateFailure(self.item,
ReprOutcome(outcome.make_repr())))
import pdb
pdb.post_mortem(excinfo._excinfo[2])
# XXX hmm, we probably will not like to continue from that point
# or we do?
raise SystemExit()
outcome.stdout = ""
outcome.stderr = ""
return outcome
/home/johnny/projects/merlinux/py/dist/py/test/rsession/local.py:31
def plain_runner(item, session, reporter):
# box executor is doing stdout/err catching for us, let's do it here
startcapture(session)
r = RunExecutor(item, usepdb=session.config.option.usepdb, reporter=reporter)
-> outcome = r.execute()
outcome = ReprOutcome(outcome.make_repr())
outcome.stdout, outcome.stderr = finishcapture(session)
return outcome
/home/johnny/projects/merlinux/py/dist/py/test/rsession/local.py:47
def apigen_runner(item, session, reporter):
r = RunExecutor(item, reporter=reporter)
session.tracer.start_tracing()
-> retval = plain_runner(item, session, reporter)
session.tracer.end_tracing()
return retval