/home/johnny/projects/merlinux/py/dist/py/magic/assertion.py:31
def revoke(): -> py.magic.revert(__builtin__, 'AssertionError')
/home/johnny/projects/merlinux/py/dist/py/magic/invoke.py:22
def revoke(assertion=False, compile=False):
""" revoke previously invoked magic (see invoke())."""
if assertion:
from py.__.magic import assertion
-> assertion.revoke()
if compile:
py.magic.revert(cpy_builtin, 'compile')
/home/johnny/projects/merlinux/py/dist/py/test/rsession/rsession.py:279
def main(self, args, reporter=None, runner=None, shouldstop=None):
# check out if used options makes any sense
if not args:
args = [py.path.local()]
sshhosts = ['localhost'] # this is just an info to reporter
if not self.config.option.nomagic:
py.magic.invoke(assertion=1)
session_options.bind_config(self.config)
reporter, checkfun, startserverflag = self.init_reporter(reporter,
sshhosts, LocalReporter, args[0])
if shouldstop:
checkfun = shouldstop
reporter(report.TestStarted(sshhosts))
pkgdir = self.getpkgdir(args[0])
colitems = self.make_colitems(args, baseon=pkgdir.dirpath())
reporter(report.RsyncFinished())
if runner is None and self.config.option.apigen:
from py.__.apigen.tracer.tracer import Tracer
# XXX
module = py
#module = __import__(str(pkgdir.join('__init__.py')))
try:
self.docstorage = self.config.getinitialvalue('ApiGen').get_doc_storage()
except (ValueError, AttributeError):
raise NotImplementedError("Need to provide conftest "
"way of generating DocStorage")
self.tracer = Tracer(self.docstorage)
runner = apigen_runner
#elif runner is None and (self.config.option.usepdb or self.config.option.nocapture):
# runner = plain_runner
#elif runner is None:
# runner = box_runner
elif runner is None:
runner = RunnerPolicy[session_options.runner_policy]
keyword = self.config.option.keyword
def itemgen():
for x in colitems:
for y in x.tryiter(reporterror = lambda x: self.reporterror(reporter, x), keyword = keyword):
yield y
itemgenerator = itemgen()
#assert 0, "\n".join([",".join(x.listnames()) for x in
# list(itemgenerator)])
# XXX: We have to decide which runner to use at this point
local_loop(self, reporter, itemgenerator, checkfun, self.config, runner=runner)
reporter(report.TestFinished())
if startserverflag:
from py.__.test.rsession.web import kill_server
kill_server()
#py.test.Function.state.teardown_all()
if not self.config.option.nomagic:
-> py.magic.revoke(assertion=1)
if self.config.option.apigen:
try:
self.config.getinitialvalue('ApiGen').write_docs(self.docstorage)
except ValueError:
raise NotImplementedError("Cannot create docs - didn't "
"provided way of doing that in conftest")
/home/johnny/projects/merlinux/py/dist/py/test/rsession/testing/test_lsession.py:164
def test_minus_k(self):
if not hasattr(py.std.os, 'fork'):
py.test.skip('operating system not supported')
tmpdir = tmp
tmpdir.ensure("sub3", "__init__.py")
tmpdir.ensure("sub3", "test_some.py").write(py.code.Source("""
def test_one():
pass
def test_one_one():
assert 0
def test_other():
raise ValueError(23)
def test_two(someargs):
pass
"""))
args = [str(tmpdir.join("sub3")), '-k', 'test_one']
config, args = py.test.Config.parse(args)
lsession = LSession(config)
allevents = []
-> lsession.main(args, reporter=allevents.append, runner=box_runner)
testevents = [x for x in allevents
if isinstance(x, report.ReceivedItemOutcome)]
assert len(testevents)
passevents = [i for i in testevents if i.outcome.passed]
failevents = [i for i in testevents if i.outcome.excinfo]
assert len(passevents) == 1
assert len(failevents) == 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