call site 2 for test.collect.Class.run
test/testing/test_collect.py - line 203
170
171
172
173
174
175
176
177
178
179
180
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
214
215
216
217
218
219
220
221
222
223
224
   def test_custom_python_collection_from_conftest():
       o = tmpdir.ensure('customconfigtest', dir=1)
       o.ensure('conftest.py').write("""if 1:
           import py
           class MyFunction(py.test.collect.Function):
               pass
           class Directory(py.test.collect.Directory):
               def filefilter(self, fspath):
                   return fspath.check(basestarts='check_', ext='.py')
           class myfuncmixin: 
               Function = MyFunction
               def funcnamefilter(self, name): 
                   return name.startswith('check_') 
   
           class Module(myfuncmixin, py.test.collect.Module):
               def classnamefilter(self, name): 
                   return name.startswith('CustomTestClass') 
           class Instance(myfuncmixin, py.test.collect.Instance):
               pass 
           """)
       checkfile = o.ensure('somedir', 'check_something.py')
       checkfile.write("""if 1:
           def check_func():
               assert 42 == 42
           class CustomTestClass:
               def check_method(self):
                   assert 23 == 23
           """)
   
       for x in (o, checkfile, checkfile.dirpath()): 
           config = py.test.config._reparse([x])
           #print "checking that %s returns custom items" % (x,) 
           col = config._getcollector(x)
->         assert len(list(col._tryiter(py.test.collect.Item))) == 2 
           #assert items[1].__class__.__name__ == 'MyFunction'
   
       # test that running a session works from the directories
       old = o.chdir() 
       try: 
           config = py.test.config._reparse([]) 
           out = py.std.cStringIO.StringIO()
           session = config._getsessionclass()(config, out) 
           session.main() 
           l = session.getitemoutcomepairs(Passed) 
           assert len(l) == 2
       finally: 
           old.chdir() 
   
       # test that running the file directly works 
       config = py.test.config._reparse([str(checkfile)]) 
       out = py.std.cStringIO.StringIO()
       session = config._getsessionclass()(config, out) 
       session.main() 
       l = session.getitemoutcomepairs(Passed) 
       assert len(l) == 2
test/collect.py - line 217
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
222
223
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. 
           """ 
       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 217
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
222
223
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. 
           """ 
       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 217
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
222
223
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. 
           """ 
       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 215
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
222
223
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. 
           """ 
       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))