Show More
@@ -77,23 +77,13 b' class IPTestController(object):' | |||
|
77 | 77 | env = os.environ.copy() |
|
78 | 78 | env.update(self.env) |
|
79 | 79 | output = subprocess.PIPE if self.buffer_output else None |
|
80 | stdout = subprocess.STDOUT if self.buffer_output else None | |
|
80 | 81 | self.process = subprocess.Popen(self.cmd, stdout=output, |
|
81 |
stderr= |
|
|
82 | stderr=stdout, env=env) | |
|
82 | 83 | |
|
83 |
def |
|
|
84 | """Run the stored commands""" | |
|
85 | try: | |
|
86 | retcode = self._run_cmd() | |
|
87 | except KeyboardInterrupt: | |
|
88 | return -signal.SIGINT | |
|
89 | except: | |
|
90 | import traceback | |
|
91 | traceback.print_exc() | |
|
92 | return 1 # signal failure | |
|
93 | ||
|
94 | if self.coverage_xml: | |
|
95 | subprocess.call(["coverage", "xml", "-o", self.coverage_xml]) | |
|
96 | return retcode | |
|
84 | def wait(self): | |
|
85 | self.stdout, _ = self.process.communicate() | |
|
86 | return self.process.returncode | |
|
97 | 87 | |
|
98 | 88 | def cleanup_process(self): |
|
99 | 89 | """Cleanup on exit by killing any leftover processes.""" |
@@ -132,6 +122,7 b' def test_controllers_to_run(inc_slow=False):' | |||
|
132 | 122 | res = [] |
|
133 | 123 | if not inc_slow: |
|
134 | 124 | test_sections['parallel'].enabled = False |
|
125 | ||
|
135 | 126 | for name in test_group_names: |
|
136 | 127 | if test_sections[name].will_run: |
|
137 | 128 | res.append(IPTestController(name)) |
@@ -146,13 +137,13 b' def do_run(controller):' | |||
|
146 | 137 | traceback.print_exc() |
|
147 | 138 | return controller, 1 # signal failure |
|
148 | 139 | |
|
149 |
exitcode = controller. |
|
|
150 | controller.cleanup() | |
|
140 | exitcode = controller.wait() | |
|
151 | 141 | return controller, exitcode |
|
152 | 142 | |
|
153 | 143 | except KeyboardInterrupt: |
|
154 | controller.cleanup() | |
|
155 | 144 | return controller, -signal.SIGINT |
|
145 | finally: | |
|
146 | controller.cleanup() | |
|
156 | 147 | |
|
157 | 148 | def report(): |
|
158 | 149 | """Return a string with a summary report of test-related variables.""" |
@@ -199,7 +190,6 b' def run_iptestall(inc_slow=False, jobs=1, xunit=False, coverage=False):' | |||
|
199 | 190 | Run the test suite in parallel, if True, using as many threads as there |
|
200 | 191 | are processors |
|
201 | 192 | """ |
|
202 | pool = multiprocessing.pool.ThreadPool(jobs) | |
|
203 | 193 | if jobs != 1: |
|
204 | 194 | IPTestController.buffer_output = True |
|
205 | 195 | |
@@ -210,23 +200,39 b' def run_iptestall(inc_slow=False, jobs=1, xunit=False, coverage=False):' | |||
|
210 | 200 | t_start = time.time() |
|
211 | 201 | |
|
212 | 202 | print('*'*70) |
|
213 | for (controller, res) in pool.imap_unordered(do_run, controllers): | |
|
214 | tgroup = 'IPython test group: ' + controller.section | |
|
215 | res_string = 'OK' if res == 0 else 'FAILED' | |
|
216 | res_string = res_string.rjust(70 - len(tgroup), '.') | |
|
217 | print(tgroup + res_string) | |
|
218 | if res: | |
|
219 | failed.append(controller) | |
|
220 | if res == -signal.SIGINT: | |
|
221 | print("Interrupted") | |
|
222 |
|
|
|
203 | if jobs == 1: | |
|
204 | for controller in controllers: | |
|
205 | print('IPython test group:', controller.section) | |
|
206 | controller, res = do_run(controller) | |
|
207 | if res: | |
|
208 | failed.append(controller) | |
|
209 | if res == -signal.SIGINT: | |
|
210 | print("Interrupted") | |
|
211 | break | |
|
212 | print() | |
|
213 | ||
|
214 | else: | |
|
215 | try: | |
|
216 | pool = multiprocessing.pool.ThreadPool(jobs) | |
|
217 | for (controller, res) in pool.imap_unordered(do_run, controllers): | |
|
218 | tgroup = 'IPython test group: ' + controller.section + ' ' | |
|
219 | res_string = ' OK' if res == 0 else ' FAILED' | |
|
220 | res_string = res_string.rjust(70 - len(tgroup), '.') | |
|
221 | print(tgroup + res_string) | |
|
222 | if res: | |
|
223 | print(controller.stdout) | |
|
224 | failed.append(controller) | |
|
225 | if res == -signal.SIGINT: | |
|
226 | print("Interrupted") | |
|
227 | break | |
|
228 | except KeyboardInterrupt: | |
|
229 | return | |
|
223 | 230 | |
|
224 | 231 | t_end = time.time() |
|
225 | 232 | t_tests = t_end - t_start |
|
226 | 233 | nrunners = len(controllers) |
|
227 | 234 | nfail = len(failed) |
|
228 | 235 | # summarize results |
|
229 | print() | |
|
230 | 236 | print('*'*70) |
|
231 | 237 | print('Test suite completed for system with the following information:') |
|
232 | 238 | print(report()) |
General Comments 0
You need to be logged in to leave comments.
Login now