##// END OF EJS Templates
Allow passing extra arguments to iptest through for nose
Thomas Kluyver -
Show More
@@ -177,13 +177,14 b' def prepare_py_test_controllers(inc_slow=False):'
177 177 not_run.append(controller)
178 178 return to_run, not_run
179 179
180 def configure_controllers(controllers, xunit=False, coverage=False):
180 def configure_controllers(controllers, xunit=False, coverage=False, extra_args=()):
181 181 """Apply options for a collection of TestController objects."""
182 182 for controller in controllers:
183 183 if xunit:
184 184 controller.add_xunit()
185 185 if coverage:
186 186 controller.add_coverage()
187 controller.cmd.extend(extra_args)
187 188
188 189 def do_run(controller):
189 190 try:
@@ -259,6 +260,9 b' def run_iptestall(options):'
259 260 coverage : bool or str
260 261 Measure code coverage from tests. True will store the raw coverage data,
261 262 or pass 'html' or 'xml' to get reports.
263
264 extra_args : list
265 Extra arguments to pass to the test subprocesses, e.g. '-v'
262 266 """
263 267 if options.fast != 1:
264 268 # If running in parallel, capture output so it doesn't get interleaved
@@ -270,7 +274,8 b' def run_iptestall(options):'
270 274 else:
271 275 to_run, not_run = prepare_py_test_controllers(inc_slow=options.all)
272 276
273 configure_controllers(to_run, xunit=options.xunit, coverage=options.coverage)
277 configure_controllers(to_run, xunit=options.xunit, coverage=options.coverage,
278 extra_args=options.extra_args)
274 279
275 280 def justify(ltext, rtext, width=70, fill='-'):
276 281 ltext += ' '
@@ -381,6 +386,18 b' def run_iptestall(options):'
381 386
382 387
383 388 def main():
389 # Arguments after -- should be passed through to nose. Argparse treats
390 # everything after -- as regular positional arguments, so we separate them
391 # first.
392 try:
393 ix = sys.argv.index('--')
394 except ValueError:
395 to_parse = sys.argv[1:]
396 extra_args = []
397 else:
398 to_parse = sys.argv[1:ix]
399 extra_args = sys.argv[ix+1:]
400
384 401 parser = argparse.ArgumentParser(description='Run IPython test suite')
385 402 parser.add_argument('testgroups', nargs='*',
386 403 help='Run specified groups of tests. If omitted, run '
@@ -395,7 +412,8 b' def main():'
395 412 help="Measure test coverage. Specify 'html' or "
396 413 "'xml' to get reports.")
397 414
398 options = parser.parse_args()
415 options = parser.parse_args(to_parse)
416 options.extra_args = extra_args
399 417
400 418 run_iptestall(options)
401 419
General Comments 0
You need to be logged in to leave comments. Login now