call site 2 for test.collect.Function.__init__
test/rsession/testing/test_lsession.py - line 157
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
   def test_minus_k(self):
       if not hasattr(py.std.os, 'fork'):
           py.test.skip('operating system not supported')
       tmpdir = tmp
       tmpdir.ensure("sub3", "__init__.py")
       tmpdir.ensure("sub3", "test_some.py").write(py.code.Source("""
               def test_one(): 
                   pass
               def test_one_one():
                   assert 0
               def test_other():
                   raise ValueError(23)
               def test_two(someargs):
                   pass
           """))
       args = [str(tmpdir.join("sub3")), '-k', 'test_one']
       config = py.test.config._reparse(args)
       lsession = LSession(config)
       allevents = []
           
->     lsession.main(reporter=allevents.append, runner=box_runner)
       testevents = [x for x in allevents 
                       if isinstance(x, repevent.ReceivedItemOutcome)]
       assert len(testevents)
       passevents = [i for i in testevents if i.outcome.passed]
       failevents = [i for i in testevents if i.outcome.excinfo]
       assert len(passevents) == 1
       assert len(failevents) == 1
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 64
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/master.py - line 46
42
43
44
45
46
47
   def itemgen(colitems, reporter, keyword, reporterror):
       def rep(x):
           reporterror(reporter, x)
       for x in colitems:
->         for y in x._tryiter(reporterror=rep, keyword=keyword):
               yield y
test/collect.py - line 214
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
   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. 
           """ 
       if yieldtype is None: 
           yieldtype = py.test.collect.Item 
       if isinstance(self, yieldtype):
           try:
               self._skipbykeyword(keyword)
               yield self
           except Skipped:
               if reporterror is not None:
                   excinfo = py.code.ExceptionInfo()
                   reporterror((excinfo, self))
       else:
           if not isinstance(self, py.test.collect.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)) 
test/collect.py - line 212
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
   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. 
           """ 
       if yieldtype is None: 
           yieldtype = py.test.collect.Item 
       if isinstance(self, yieldtype):
           try:
               self._skipbykeyword(keyword)
               yield self
           except Skipped:
               if reporterror is not None:
                   excinfo = py.code.ExceptionInfo()
                   reporterror((excinfo, self))
       else:
           if not isinstance(self, py.test.collect.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)) 
test/collect.py - line 350
347
348
349
350
   def run(self):
       if getattr(self.obj, 'disabled', 0):
           return []
->     return super(Module, self).run()
test/collect.py - line 336
335
336
337
338
339
   def run(self): 
->     self._prepare()
       itemlist = self._name2items.values()
       itemlist.sort()
       return [x.name for x in itemlist]
test/collect.py - line 328
322
323
324
325
326
327
328
329
330
331
332
333
   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
test/collect.py - line 307
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
   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
test/collect.py - line 320
312
313
314
315
316
317
318
319
320
   def makeitem(self, name, obj, usefilters=True):
       if (not usefilters or self.classnamefilter(name)) and \
           py.std.inspect.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)