call site 6 for path.local.chdir
test/testing/test_collect.py - line 263
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
   def test_custom_NONpython_collection_from_conftest():
       o = tmpdir.ensure('customconfigtest_nonpython', dir=1)
       o.ensure('conftest.py').write("""if 1:
           import py
           class CustomItem(py.test.collect.Item): 
               def run(self):
                   pass
   
           class Directory(py.test.collect.Directory):
               def filefilter(self, fspath):
                   return fspath.check(basestarts='check_', ext='.txt')
               def join(self, name):
                   if not name.endswith('.txt'): 
                       return super(Directory, self).join(name) 
                   p = self.fspath.join(name) 
                   if p.check(file=1): 
                       return CustomItem(p, parent=self)
           """)
       checkfile = o.ensure('somedir', 'moredir', 'check_something.txt')
   
       for x in (o, checkfile, checkfile.dirpath()): 
           print "checking that %s returns custom items" % (x,) 
           config = py.test.config._reparse([x])
           col = config._getcollector(x)
           assert len(list(col._tryiter(py.test.collect.Item))) == 1
           #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) == 1
       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) == 1