call site 2 for execnet.PopenGateway.exit
test/rsession/testing/test_rsession.py - line 92
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
   def test_distribution_rsync_roots_example(self):
       destdir = py.test.ensuretemp("example_dist_destdir")
       subdir = "sub_example_dist"
       tmpdir = self.source
       tmpdir.ensure(subdir, "conftest.py").write(py.code.Source("""
               dist_hosts = ["localhost:%s"]
               dist_rsync_roots = ["%s", "../py"]
           """ % (destdir, tmpdir.join(subdir), )))
       tmpdir.ensure(subdir, "__init__.py")
       tmpdir.ensure(subdir, "test_one.py").write(py.code.Source("""
               def test_1(): 
                   pass
               def test_2():
                   assert 0
               def test_3():
                   raise ValueError(23)
               def test_4(someargs):
                   pass
               def test_5():
                   assert __file__ != '%s'
               #def test_6():
               #    import py
               #    assert py.__file__ != '%s'
           """ % (tmpdir.join(subdir), py.__file__)))
       destdir.join("py").mksymlinkto(py.path.local(py.__file__).dirpath())
       config = py.test.config._reparse([tmpdir.join(subdir)])
       assert config.topdir == tmpdir
       assert not tmpdir.join("__init__.py").check()
       rsession = RSession(config)
       allevents = []
->     rsession.main(reporter=allevents.append) 
       testevents = [x for x in allevents 
                       if isinstance(x, repevent.ReceivedItemOutcome)]
       assert len(testevents)
       print testevents
       passevents = [i for i in testevents if i.outcome.passed]
       failevents = [i for i in testevents if i.outcome.excinfo]
       skippedevents = [i for i in testevents if i.outcome.skipped]
       assert len(testevents) == 5
       assert len(passevents) == 2
       assert len(failevents) == 3
       tb = failevents[0].outcome.excinfo.traceback
       assert str(tb[0].path).find("test_one") != -1
       assert tb[0].source.find("test_2") != -1
       assert failevents[0].outcome.excinfo.typename == 'AssertionError'
       tb = failevents[1].outcome.excinfo.traceback
       assert str(tb[0].path).find("test_one") != -1
       assert tb[0].source.find("test_3") != -1
       assert failevents[1].outcome.excinfo.typename == 'ValueError'
       assert failevents[1].outcome.excinfo.value == '23'
       tb = failevents[2].outcome.excinfo.traceback
       assert failevents[2].outcome.excinfo.typename == 'TypeError'
       assert str(tb[0].path).find("executor") != -1
       assert tb[0].source.find("execute") != -1
test/rsession/rsession.py - line 157
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/hostmanage.py - line 177
165
166
167
168
169
170
171
172
173
174
175
176
177
   def teardown_hosts(self, reporter, channels, nodes,
                      waiter=lambda : time.sleep(.1), exitfirst=False):
       for channel in channels:
           channel.send(None)
       
       clean = exitfirst
       while not clean:
           clean = True
           for node in nodes:
               if node.pending:
                   clean = False
           waiter()
->     self.teardown_gateways(reporter, channels)
test/rsession/hostmanage.py - line 191
183
184
185
186
187
188
189
190
191
   def teardown_gateways(self, reporter, channels):
       for channel in channels:
           #try:
           try:
               repevent.wrapcall(reporter, channel.waitclose, 1)
           except IOError: # timeout
               # force closing
               channel.close()
->         channel.gateway.exit()