/home/johnny/projects/merlinux/py/dist/py/test/collect.py:224
def tryiter(self, yieldtype=None, reporterror=None, keyword=None):
""" yield stop item instances from flattening the collector.
XXX deprecated: this way of iteration is not safe in all
cases. Mostly fixed, need to introduce skipped-by-keyword
"""
if yieldtype is None:
yieldtype = py.test.Item
if isinstance(self, yieldtype):
try:
self.skipbykeyword(keyword)
yield self
except py.test.Item.Skipped:
if reporterror is not None:
excinfo = py.code.ExceptionInfo()
reporterror((excinfo, self))
else:
if not isinstance(self, py.test.Item):
try:
if reporterror is not None:
reporterror((None, self))
-> for x in self.run():
for y in self.join(x).tryiter(yieldtype, reporterror, keyword):
yield y
except KeyboardInterrupt:
raise
except:
if reporterror is not None:
excinfo = py.code.ExceptionInfo()
reporterror((excinfo, self))
/home/johnny/projects/merlinux/py/dist/py/test/rsession/testing/test_reporter.py:126
def boxfun():
config, args = py.test.Config.parse([str(tmpdir)])
rootcol = py.test.collect.Directory(tmpdir)
r = self.reporter(config, ["localhost"])
r.report(report.TestStarted(['localhost']))
r.report(report.RsyncFinished())
-> list(rootcol.tryiter(reporterror=lambda x : AbstractSession.reporterror(r.report, x)))
r.report(report.TestFinished())
/home/johnny/projects/merlinux/py/dist/py/test/rsession/testing/test_reporter.py:132
def test_failed_to_load(self):
tmpdir = py.test.ensuretemp("failedtoload")
tmpdir.ensure("__init__.py")
tmpdir.ensure("test_three.py").write(py.code.Source("""
sadsadsa
"""))
def boxfun():
config, args = py.test.Config.parse([str(tmpdir)])
rootcol = py.test.collect.Directory(tmpdir)
r = self.reporter(config, ["localhost"])
r.report(report.TestStarted(['localhost']))
r.report(report.RsyncFinished())
list(rootcol.tryiter(reporterror=lambda x : AbstractSession.reporterror(r.report, x)))
r.report(report.TestFinished())
s = StringIO()
stdoutcopy = sys.stdout
sys.stdout = s
-> boxfun()
sys.stdout = stdoutcopy
assert s.getvalue().find("NameError: name 'sadsadsa' is not defined") != -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