call site 8 for code.Traceback.cut
test/rsession/testing/test_executor.py - line 151
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
   def test_apigen_executor(self):
       class Tracer(object):
           def __init__(self):
               self.starts = 0
               self.ends = 0
           
           def start_tracing(self):
               self.starts += 1
   
           def end_tracing(self):
               self.ends += 1
       
       tmpdir = py.test.ensuretemp("apigen_executor")
       tmpdir.ensure("__init__.py")
       tmpdir.ensure("test_one.py").write(py.code.Source("""
           def g():
               pass
       
           def test_1():
               g()
   
           class TestX(object):
               def setup_method(self, m):
                   self.ttt = 1
   
               def test_one(self):
                   self.ttt += 1
   
               def test_raise(self):
                   1/0
           """))
       config = py.test.config._reparse([tmpdir])
       rootcol = config._getcollector(tmpdir)
       tracer = Tracer()
       item = rootcol._getitembynames("test_one.py/test_1")
       ex = ApigenExecutor(item, config=config)
       out1 = ex.execute(tracer)
       item = rootcol._getitembynames("test_one.py/TestX/()/test_one")
       ex = ApigenExecutor(item, config=config)
       out2 = ex.execute(tracer)
       item = rootcol._getitembynames("test_one.py/TestX/()/test_raise")
       ex = ApigenExecutor(item, config=config)
->     out3 = ex.execute(tracer)
       assert tracer.starts == 3
       assert tracer.ends == 3
       assert out1.passed
       assert out2.passed
       assert not out3.passed
test/rsession/executor.py - line 72
70
71
72
   def execute(self, tracer):
       self.tracer = tracer
->     return super(ApigenExecutor, self).execute()
test/rsession/executor.py - line 51
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