/home/johnny/projects/merlinux/py/dist/py/io/capture.py:35
def maketmpfile(self):
f = os.tmpfile()
-> newf = py.io.dupfile(f)
f.close()
return newf
/home/johnny/projects/merlinux/py/dist/py/io/capture.py:10
def __init__(self, targetfd, tmpfile=None):
self.targetfd = targetfd
if tmpfile is None:
-> tmpfile = self.maketmpfile()
self.tmpfile = tmpfile
self._savefd = os.dup(targetfd)
os.dup2(self.tmpfile.fileno(), targetfd)
self._patched = []
/home/johnny/projects/merlinux/py/dist/py/io/capture.py:49
def __init__(self, out=True, err=True, patchsys=True):
if out:
self.out = FDCapture(1)
if patchsys:
self.out.setasfile('stdout')
if err:
-> self.err = FDCapture(2)
if patchsys:
self.err.setasfile('stderr')
/home/johnny/projects/merlinux/py/dist/py/io/test/test_capture.py:35
def getcapture(self): -> return py.io.OutErrCapture()
/home/johnny/projects/merlinux/py/dist/py/io/test/test_capture.py:54
def test_capturing_modify_sysouterr_in_between(self):
oldout = sys.stdout
olderr = sys.stderr
-> cap = self.getcapture()
print "hello",
print >>sys.stderr, "world",
sys.stdout = py.std.StringIO.StringIO()
sys.stderr = py.std.StringIO.StringIO()
print "not seen"
print >>sys.stderr, "not seen"
out, err = cap.reset()
assert out == "hello"
assert err == "world"
assert sys.stdout == oldout
assert sys.stderr == olderr
/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