traceback for test.collect.Directory.setup

/home/johnny/projects/merlinux/py/dist/py/test/item.py:29

   def prepare(self, colitem): 
       """ setup objects along the collector chain to the test-method
               Teardown any unneccessary previously setup objects. 
           """
       needed_collectors = colitem.listchain() 
       while self.stack: 
           if self.stack == needed_collectors[:len(self.stack)]: 
               break 
           col = self.stack.pop() 
           col.teardown()
       for col in needed_collectors[len(self.stack):]: 
           #print "setting up", col
->         col.setup() 
           self.stack.append(col) 

/home/johnny/projects/merlinux/py/dist/py/test/item.py:72

   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:73

   def local_loop(session, reporter, itemgenerator, shouldstop, config, runner=None):
       assert runner is not None
       #if runner is None:
       #    if session.config.option.apigen:
       #        runner = apigen_runner
       #    else:
       #    runner = box_runner
       while 1:
           try:
               item = itemgenerator.next()
               if shouldstop():
                   return
->             outcome = runner(item, session, reporter)
               reporter(report.ReceivedItemOutcome(None, item, outcome))
           except StopIteration:
               break

/home/johnny/projects/merlinux/py/dist/py/test/rsession/rsession.py:270

   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:97

   def test_pdb_run(self):
       # we make sure that pdb is engaged
       tmpdir = tmp
       tmpdir.ensure("sub", "__init__.py")
       tmpdir.ensure("sub", "test_one.py").write(py.code.Source("""
               def test_1(): 
                   assert 0
           """))
       import pdb
       l = []
       def some_fun(*args):
           l.append(args)
           
       pdb.post_mortem = some_fun
       args = [str(tmpdir.join("sub")), '--pdb']
       config, args = py.test.Config.parse(args)
       lsession = LSession(config)
       allevents = []
       try:
->         lsession.main(args, reporter=allevents.append, runner=plain_runner)
       except SystemExit:
           pass
       else:
           py.test.fail("Didn't raise system exit")
       failure_events = [event for event in allevents if isinstance(event,
           report.ImmediateFailure)]
       assert len(failure_events) == 1
       assert len(l) == 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