/home/johnny/projects/merlinux/py/dist/py/test/rsession/rest.py:133
def failures(self):
tbstyle = self.config.option.tbstyle
if self.failed_tests_outcome:
self.add_rest(Title('Exceptions:', belowchar='+'))
for i, event in enumerate(self.failed_tests_outcome):
if i > 0:
self.add_rest(Transition())
if isinstance(event, report.ReceivedItemOutcome):
-> host = self.get_host(event)
itempath = self.get_path_from_item(event.item)
root = self.get_rootpath(event.item)
link = self.get_linkwriter().get_link(root, event.item.fspath)
t = Title(belowchar='+')
if link:
t.add(Link(itempath, link))
else:
t.add(Text(itempath))
t.add(Text('on %s' % (host,)))
self.add_rest(t)
if event.outcome.signal:
self.repr_signal(event.item, event.outcome)
else:
self.repr_failure(event.item, event.outcome, tbstyle)
else:
itempath = self.get_path_from_item(event.item)
root = self.get_rootpath(event.item)
link = self.get_linkwriter().get_link(root, event.item.fspath)
t = Title(abovechar='+', belowchar='+')
if link:
t.add(Link(itempath, link))
else:
t.add(Text(itempath))
out = outcome.Outcome(excinfo=event.excinfo)
self.repr_failure(event.item,
outcome.ReprOutcome(out.make_repr()),
tbstyle)
/home/johnny/projects/merlinux/py/dist/py/test/rsession/testing/test_rest.py:183
def test_failures(self):
parent = Container(parent=None, fspath=py.path.local('.'))
reporter.failed_tests_outcome = [
FakeOutcome(
outcome=Container(
signal=False,
excinfo=Container(
typename='FooError',
value='A foo has occurred',
traceback=[
Container(
path='foo/bar.py',
lineno=1,
relline=1,
source='foo()',
),
Container(
path='foo/baz.py',
lineno=4,
relline=1,
source='raise FooError("A foo has occurred")',
),
]
),
stdout='',
stderr='',
),
item=Container(
listnames=lambda: ['package', 'foo', 'bar.py',
'baz', '()'],
parent=parent,
fspath=py.path.local('.'),
),
channel=None,
),
]
reporter.config.option.tbstyle = 'no'
-> reporter.failures()
assert stdout.getvalue() == """\
Exceptions\:
++++++++++++
foo/bar.py/baz() on localhost
+++++++++++++++++++++++++++++
FooError
++++++++
::
A foo has occurred
"""
reporter.config.option.tbstyle = 'short'
stdout.seek(0)
stdout.truncate()
reporter.failures()
assert stdout.getvalue() == """\
Exceptions\:
++++++++++++
foo/bar.py/baz() on localhost
+++++++++++++++++++++++++++++
::
foo/bar.py line 1
foo()
foo/baz.py line 4
raise FooError("A foo has occurred")
FooError
++++++++
::
A foo has occurred
"""
reporter.config.option.tbstyle = 'long'
stdout.seek(0)
stdout.truncate()
reporter.failures()
stdout.getvalue() == """\
Exceptions\:
++++++++++++
foo/bar.py/baz() on localhost
+++++++++++++++++++++++++++++
+++++++++++++++++
foo/bar.py line 1
+++++++++++++++++
::
foo()
+++++++++++++++++
foo/baz.py line 4
+++++++++++++++++
::
raise FooError("A foo has occurred")
FooError
++++++++
::
A foo has occurred
"""
/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