##// END OF EJS Templates
Also show which test groups didn't run
Thomas Kluyver -
Show More
@@ -28,7 +28,6 import subprocess
28 28 import time
29 29
30 30 from .iptest import have, test_group_names, test_sections
31 from IPython.utils import py3compat
32 31 from IPython.utils.sysinfo import sys_info
33 32 from IPython.utils.tempdir import TemporaryDirectory
34 33
@@ -67,6 +66,10 class IPTestController(object):
67 66 # This means we won't get odd effects from our own matplotlib config
68 67 self.env['MPLCONFIGDIR'] = workingdir.name
69 68
69 @property
70 def will_run(self):
71 return test_sections[self.section].will_run
72
70 73 def add_xunit(self):
71 74 xunit_file = os.path.abspath(self.section + '.xunit.xml')
72 75 self.cmd.extend(['--with-xunit', '--xunit-file', xunit_file])
@@ -133,21 +136,23 class IPTestController(object):
133 136
134 137 __del__ = cleanup
135 138
136 def test_controllers_to_run(inc_slow=False, xunit=False, coverage=False):
139 def prepare_test_controllers(inc_slow=False, xunit=False, coverage=False):
137 140 """Returns an ordered list of IPTestController instances to be run."""
138 res = []
141 to_run, not_run = [], []
139 142 if not inc_slow:
140 143 test_sections['parallel'].enabled = False
141 144
142 145 for name in test_group_names:
143 if test_sections[name].will_run:
144 controller = IPTestController(name)
145 if xunit:
146 controller.add_xunit()
147 if coverage:
148 controller.add_coverage()
149 res.append(controller)
150 return res
146 controller = IPTestController(name)
147 if xunit:
148 controller.add_xunit()
149 if coverage:
150 controller.add_coverage()
151 if controller.will_run:
152 to_run.append(controller)
153 else:
154 not_run.append(controller)
155 return to_run, not_run
151 156
152 157 def do_run(controller):
153 158 try:
@@ -214,16 +219,21 def run_iptestall(inc_slow=False, jobs=1, xunit_out=False, coverage_out=False):
214 219 if jobs != 1:
215 220 IPTestController.buffer_output = True
216 221
217 controllers = test_controllers_to_run(inc_slow=inc_slow, xunit=xunit_out,
222 to_run, not_run = prepare_test_controllers(inc_slow=inc_slow, xunit=xunit_out,
218 223 coverage=coverage_out)
219 224
225 def justify(ltext, rtext, width=70, fill='-'):
226 ltext += ' '
227 rtext = (' ' + rtext).rjust(width - len(ltext), fill)
228 return ltext + rtext
229
220 230 # Run all test runners, tracking execution time
221 231 failed = []
222 232 t_start = time.time()
223 233
224 234 print('*'*70)
225 235 if jobs == 1:
226 for controller in controllers:
236 for controller in to_run:
227 237 print('IPython test group:', controller.section)
228 238 controller, res = do_run(controller)
229 239 if res:
@@ -236,11 +246,9 def run_iptestall(inc_slow=False, jobs=1, xunit_out=False, coverage_out=False):
236 246 else:
237 247 try:
238 248 pool = multiprocessing.pool.ThreadPool(jobs)
239 for (controller, res) in pool.imap_unordered(do_run, controllers):
240 tgroup = 'IPython test group: ' + controller.section + ' '
241 res_string = ' OK' if res == 0 else ' FAILED'
242 res_string = res_string.rjust(70 - len(tgroup), '.')
243 print(tgroup + res_string)
249 for (controller, res) in pool.imap_unordered(do_run, to_run):
250 res_string = 'OK' if res == 0 else 'FAILED'
251 print(justify('IPython test group: ' + controller.section, res_string))
244 252 if res:
245 253 print(controller.stdout)
246 254 failed.append(controller)
@@ -250,9 +258,12 def run_iptestall(inc_slow=False, jobs=1, xunit_out=False, coverage_out=False):
250 258 except KeyboardInterrupt:
251 259 return
252 260
261 for controller in not_run:
262 print(justify('IPython test group: ' + controller.section, 'NOT RUN'))
263
253 264 t_end = time.time()
254 265 t_tests = t_end - t_start
255 nrunners = len(controllers)
266 nrunners = len(to_run)
256 267 nfail = len(failed)
257 268 # summarize results
258 269 print('*'*70)
General Comments 0
You need to be logged in to leave comments. Login now