call site 0 for test.collect.Function.startcapture
test/rsession/testing/test_lsession.py - line 262
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
   def test_nocapture(self):
       tmpdir = tmp
       tmpdir.ensure("sub7", "__init__.py")
       tmpdir.ensure("sub7", "test_nocap.py").write(py.code.Source("""
           def test_one():
               print 1
               print 2
               print 3
           """))
       args = [str(tmpdir.join("sub7"))]
       config = py.test.config._reparse(args)
       lsession = LSession(config)
       allevents = []
->     lsession.main(reporter=allevents.append, runner=plain_runner)
       testevents = [x for x in allevents 
                       if isinstance(x, repevent.ReceivedItemOutcome)]
       assert len(testevents) == 1
       assert testevents[0].outcome.passed
       assert testevents[0].outcome.stderr == ""
       assert testevents[0].outcome.stdout == "1\n2\n3\n"
test/rsession/rsession.py - line 204
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
   def main(self, reporter=None, runner=None):
       # check out if used options makes any sense
       args = self.config.args  
          
       hm = HostManager(self.config, hosts=[HostInfo('localhost')])
       hosts = hm.hosts
       if not self.config.option.nomagic:
           py.magic.invoke(assertion=1)
   
       reporter, startserverflag = self.init_reporter(reporter, 
           hosts, LocalReporter, args[0])
       reporter, checkfun = self.wrap_reporter(reporter)
           
       reporter(repevent.TestStarted(hosts, self.config.topdir, []))
       colitems = self.config.getcolitems()
       reporter(repevent.RsyncFinished())
   
       if runner is None:
           runner = self.init_runner()
   
       keyword = self.config.option.keyword
   
       itemgenerator = itemgen(colitems, reporter, keyword, self.reporterror)
->     local_loop(self, reporter, itemgenerator, checkfun, self.config, runner=runner)
           
       retval = reporter(repevent.TestFinished())
       self.kill_server(startserverflag)
   
       if not self.config.option.nomagic:
           py.magic.revoke(assertion=1)
   
       self.write_docs()
       return retval
test/rsession/local.py - line 67
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
   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(repevent.ReceivedItemOutcome(None, item, outcome))
           except StopIteration:
               break
test/rsession/local.py - line 29
27
28
29
30
31
   def plain_runner(item, session, reporter):
       r = RunExecutor(item, usepdb=session.config.option.usepdb, reporter=reporter, config=session.config)
->     outcome = r.execute()
       outcome = ReprOutcome(outcome.make_repr(session.config.option.tbstyle))
       return outcome
test/rsession/executor.py - line 35
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
   def execute(self, capture=True):
       try:
->         self.run(capture)
           outcome = Outcome()
       except Skipped, e: 
           outcome = Outcome(skipped=str(e))
       except (SystemExit, KeyboardInterrupt):
           raise
       except:
           e = sys.exc_info()[1]
           if isinstance(e, Failed) and e.excinfo:
               excinfo = e.excinfo
           else:
               excinfo = py.code.ExceptionInfo()
               if isinstance(self.item, py.test.collect.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(repevent.ImmediateFailure(self.item,
                       ReprOutcome(outcome.make_repr
                                   (self.config.option.tbstyle))))
               import pdb
               pdb.post_mortem(excinfo._excinfo[2])
               # XXX hmm, we probably will not like to continue from that
               #     point
               raise SystemExit()
       outcome.stdout, outcome.stderr = self.item._getouterr()
       return outcome
test/rsession/executor.py - line 25
23
24
25
26
27
28
29
30
31
   def run(self, capture=True):
       if capture:
->         self.item.startcapture()
           try:
               self.item.run()
           finally:
               self.item.finishcapture()
       else:
           self.item.run()