call site 0 for test.collect.Directory.filefilter
test/rsession/testing/test_rsession.py - line 199
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
   def test_nice_level(self):
       """ Tests if nice level behaviour is ok
           """
       allevents = []
       hosts = [HostInfo('localhost:%s' % self.dest)]
       tmpdir = self.source
       tmpdir.ensure("__init__.py")
       tmpdir.ensure("conftest.py").write(py.code.Source("""
           dist_hosts = ['localhost:%s']
           dist_nicelevel = 10
           """ % self.dest))
       tmpdir.ensure("test_one.py").write("""def test_nice():
               import os
               assert os.nice(0) == 10
           """)
           
       config = py.test.config._reparse([tmpdir])
       rsession = RSession(config)
       allevents = []
->     rsession.main(reporter=allevents.append) 
       testevents = [x for x in allevents 
                       if isinstance(x, repevent.ReceivedItemOutcome)]
       passevents = [x for x in testevents if x.outcome.passed]
       assert len(passevents) == 1
test/rsession/rsession.py - line 146
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
157
158
159
160
161
162
163
164
165
166
167
168
169
   def main(self, reporter=None):
       """ main loop for running tests. """
       args = self.config.args
   
       hm = HostManager(self.config)
       reporter, startserverflag = self.init_reporter(reporter,
           hm.hosts, RemoteReporter)
       reporter, checkfun = self.wrap_reporter(reporter)
   
       reporter(repevent.TestStarted(hm.hosts, self.config.topdir,
                                     hm.roots))
   
       try:
           nodes = hm.setup_hosts(reporter)
           reporter(repevent.RsyncFinished())
           try:
->             self.dispatch_tests(nodes, reporter, checkfun)
           except (KeyboardInterrupt, SystemExit):
               print >>sys.stderr, "C-c pressed waiting for gateways to teardown..."
               channels = [node.channel for node in nodes]
               hm.kill_channels(channels)
               hm.teardown_gateways(reporter, channels)
               print >>sys.stderr, "... Done"
               raise
   
           channels = [node.channel for node in nodes]
           hm.teardown_hosts(reporter, channels, nodes, 
                             exitfirst=self.config.option.exitfirst)
           reporter(repevent.Nodes(nodes))
           retval = reporter(repevent.TestFinished())
           self.kill_server(startserverflag)
           return retval
       except (KeyboardInterrupt, SystemExit):
           reporter(repevent.InterruptedExecution())
           self.kill_server(startserverflag)
           raise
       except:
           reporter(repevent.CrashedExecution())
           self.kill_server(startserverflag)
           raise
test/rsession/rsession.py - line 176
171
172
173
174
175
176
   def dispatch_tests(self, nodes, reporter, checkfun):
       colitems = self.config.getcolitems()
       keyword = self.config.option.keyword
       itemgenerator = itemgen(colitems, reporter, keyword, self.reporterror)
           
->     all_tests = dispatch_loop(nodes, itemgenerator, checkfun)
test/rsession/master.py - line 59
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
   def dispatch_loop(masternodes, itemgenerator, shouldstop, 
                     waiter = lambda: py.std.time.sleep(0.1),
                     max_tasks_per_node=None):
       if not max_tasks_per_node:
           max_tasks_per_node = py.test.config.getvalue("dist_taskspernode")
       all_tests = {}
       while 1:
           try:
               for node in masternodes:
                   if len(node.pending) < max_tasks_per_node:
->                     item = itemgenerator.next()
                       all_tests[item] = True
                       if shouldstop():
                           for _node in masternodes:
                               _node.send(StopIteration) # magic connector
                           return None
                       node.send(item)
           except StopIteration:
               break
           waiter()
       return all_tests
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 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)) 
test/collect.py - line 266
262
263
264
265
266
267
268
269
270
271
272
   def run(self):
       files = []
       dirs = []
       for p in self.fspath.listdir():
->         if self.filefilter(p):
               files.append(p.basename)
           elif self.recfilter(p):
               dirs.append(p.basename) 
       files.sort()
       dirs.sort()
       return files + dirs