traceback for test.collect.Instance.classnamefilter

/home/johnny/projects/merlinux/py/dist/py/test/collect.py:337

   def makeitem(self, name, obj, usefilters=True): 
->     if (not usefilters or self.classnamefilter(name)) and isclass(obj): 
           return self.Class(name, parent=self) 
       elif (not usefilters or self.funcnamefilter(name)) and callable(obj): 
           if obj.func_code.co_flags & 32: # generator function 
               return self.Generator(name, parent=self) 
           else: 
               return self.Function(name, parent=self) 

/home/johnny/projects/merlinux/py/dist/py/test/collect.py:331

   def buildname2items(self): 
       # NB. we avoid random getattrs and peek in the __dict__ instead
       d = {}
       dicts = [getattr(self.obj, '__dict__', {})]
       for basecls in py.std.inspect.getmro(self.obj.__class__):
           dicts.append(basecls.__dict__)
       seen = {}
       for dic in dicts:
           for name, obj in dic.items():
               if name in seen:
                   continue
               seen[name] = True
->             res = self.makeitem(name, obj)
               if res is not None:
                   d[name] = res 
       return d

/home/johnny/projects/merlinux/py/dist/py/test/collect.py:240

   def _prepare(self): 
       if not hasattr(self, '_name2items'): 
           ex = getattr(self, '_name2items_exception', None)
           if ex is not None: 
               raise ex[0], ex[1], ex[2]
           try: 
->             self._name2items = self.buildname2items()
           except (SystemExit, KeyboardInterrupt): 
               raise 
           except:
               self._name2items_exception = py.std.sys.exc_info()
               raise 

/home/johnny/projects/merlinux/py/dist/py/test/collect.py:254

   def run(self): 
->     self._prepare()
       itemlist = self._name2items.values()
       itemlist.sort()
       return [x.name for x in itemlist]

/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/collect.py:225

   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/terminal/terminal.py:72

   def startiteration(self, colitem, subitems): 
       if (isinstance(colitem, py.test.collect.Module) 
           and self.config.option.verbose == 0 
           and not self.config.option.collectonly): 
           try: 
               sum = 0
               for sub in subitems: 
->                 sum += len(list(colitem.join(sub).tryiter()))
           except (SystemExit, KeyboardInterrupt): 
               raise 
           except: 
               self.out.write('[?]')
           else: 
               self.out.write('[%d] ' % sum) 
           return self.out.line 

/home/johnny/projects/merlinux/py/dist/py/test/session.py:101

   def run(self, colitem): 
       if self.config.option.collectonly and isinstance(colitem, py.test.Item): 
           return 
       if isinstance(colitem, py.test.Item): 
           self.skipbykeyword(colitem)
       res = colitem.run() 
       if res is None: 
           return py.test.Item.Passed() 
       elif not isinstance(res, (list, tuple)): 
           raise TypeError("%r.run() returned neither "
                           "list, tuple nor None: %r" % (colitem, res))
       else: 
->         finish = self.startiteration(colitem, res)
           try: 
               for name in res: 
                   obj = colitem.join(name) 
                   assert obj is not None 
                   self.runtraced(obj) 
           finally: 
               if finish: 
                   finish() 
       return res 

/home/johnny/projects/merlinux/py/dist/py/test/session.py:71

   def runtraced(self, colitem):
       if self.shouldclose(): 
           raise Exit, "received external close signal" 
   
       outcome = None 
       colitem.startcapture() 
       try: 
           self.start(colitem)
           try: 
               try:
                   if colitem._stickyfailure: 
                       raise colitem._stickyfailure 
->                 outcome = self.run(colitem) 
               except (KeyboardInterrupt, Exit): 
                   raise 
               except colitem.Outcome, outcome: 
                   if outcome.excinfo is None: 
                       outcome.excinfo = py.code.ExceptionInfo() 
               except: 
                   excinfo = py.code.ExceptionInfo() 
                   outcome = colitem.Failed(excinfo=excinfo) 
               assert (outcome is None or 
                       isinstance(outcome, (list, colitem.Outcome)))
           finally: 
               self.finish(colitem, outcome) 
           if isinstance(outcome, colitem.Failed) and self.config.option.exitfirst:
               py.test.exit("exit on first problem configured.", item=colitem)
       finally: 
           colitem.finishcapture()

/home/johnny/projects/merlinux/py/dist/py/test/session.py:46

   def main(self, args): 
       """ main loop for running tests. """
       colitems = self._map2colitems(args) 
       try:
           self.header(colitems) 
           try:
               for colitem in colitems: 
                   colitem.option = self.config.option
->                 self.runtraced(colitem)
           except KeyboardInterrupt: 
               raise 
           except: 
               self.footer(colitems) 
           else: 
               self.footer(colitems) 
       except Exit, ex:
           pass
       # return [(fspath as string, [names as string])]
       return [(str(item.listchain()[0].fspath), item.listnames())
               for item, outcome in self.getitemoutcomepairs(py.test.Item.Failed)]

/home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py:34

   def main(self, args): 
       if self.config.option._remote: 
           from py.__.test.terminal import remote 
           return remote.main(self.config, self._file, self.config._origargs)
       else: 
->         return super(TerminalSession, self).main(args) 

/home/johnny/projects/merlinux/py/dist/py/documentation/example/pytest/test_failures.py:8

   def test_failure_demo_fails_properly(): 
       config, args = py.test.Config.parse([]) 
       session = config.getsessionclass()(config, py.std.sys.stdout)
->     session.main([failure_demo]) 
       l = session.getitemoutcomepairs(py.test.Item.Failed)
       assert len(l) == 21 
       l = session.getitemoutcomepairs(py.test.Item.Passed)
       assert not l 

/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