Show More
@@ -337,6 +337,7 b' class IPTester(object):' | |||||
337 | processes = None |
|
337 | processes = None | |
338 | #: str, coverage xml output file |
|
338 | #: str, coverage xml output file | |
339 | coverage_xml = None |
|
339 | coverage_xml = None | |
|
340 | buffer_output = False | |||
340 |
|
341 | |||
341 | def __init__(self, runner='iptest', params=None): |
|
342 | def __init__(self, runner='iptest', params=None): | |
342 | """Create new test runner.""" |
|
343 | """Create new test runner.""" | |
@@ -383,8 +384,9 b' class IPTester(object):' | |||||
383 | env = os.environ.copy() |
|
384 | env = os.environ.copy() | |
384 | env['IPYTHONDIR'] = IPYTHONDIR |
|
385 | env['IPYTHONDIR'] = IPYTHONDIR | |
385 | # print >> sys.stderr, '*** CMD:', ' '.join(self.call_args) # dbg |
|
386 | # print >> sys.stderr, '*** CMD:', ' '.join(self.call_args) # dbg | |
386 | subp = subprocess.Popen(self.call_args, stdout=subprocess.PIPE, |
|
387 | output = subprocess.PIPE if self.buffer_output else None | |
387 | stderr=subprocess.PIPE, env=env) |
|
388 | subp = subprocess.Popen(self.call_args, stdout=output, | |
|
389 | stderr=output, env=env) | |||
388 | self.processes.append(subp) |
|
390 | self.processes.append(subp) | |
389 | # If this fails, the process will be left in self.processes and |
|
391 | # If this fails, the process will be left in self.processes and | |
390 | # cleaned up later, but if the wait call succeeds, then we can |
|
392 | # cleaned up later, but if the wait call succeeds, then we can | |
@@ -547,15 +549,10 b' def run_iptest():' | |||||
547 |
|
549 | |||
548 | def do_run(x): |
|
550 | def do_run(x): | |
549 | print('IPython test group:',x[0]) |
|
551 | print('IPython test group:',x[0]) | |
550 | #if x[0] == 'IPython.kernel': |
|
|||
551 | # import os |
|
|||
552 | # os.environ['NOSE_PROCESS_TIMEOUT'] = '20' |
|
|||
553 | # os.environ['NOSE_PROCESSES'] = '2' |
|
|||
554 | ret = x[1].run() |
|
552 | ret = x[1].run() | |
555 | print('finished test group:',x[0]) |
|
|||
556 | return ret |
|
553 | return ret | |
557 |
|
554 | |||
558 | def run_iptestall(inc_slow=False): |
|
555 | def run_iptestall(inc_slow=False, fast=False): | |
559 | """Run the entire IPython test suite by calling nose and trial. |
|
556 | """Run the entire IPython test suite by calling nose and trial. | |
560 |
|
557 | |||
561 | This function constructs :class:`IPTester` instances for all IPython |
|
558 | This function constructs :class:`IPTester` instances for all IPython | |
@@ -569,8 +566,15 b' def run_iptestall(inc_slow=False):' | |||||
569 | inc_slow : bool, optional |
|
566 | inc_slow : bool, optional | |
570 | Include slow tests, like IPython.parallel. By default, these tests aren't |
|
567 | Include slow tests, like IPython.parallel. By default, these tests aren't | |
571 | run. |
|
568 | run. | |
|
569 | ||||
|
570 | fast : bool, option | |||
|
571 | Run the test suite in parallel, if True, using as many threads as there | |||
|
572 | are processors | |||
572 | """ |
|
573 | """ | |
573 | p = multiprocessing.pool.ThreadPool() |
|
574 | if fast: | |
|
575 | p = multiprocessing.pool.ThreadPool() | |||
|
576 | else: | |||
|
577 | p = multiprocessing.pool.ThreadPool(1) | |||
574 |
|
578 | |||
575 | runners = make_runners(inc_slow=inc_slow) |
|
579 | runners = make_runners(inc_slow=inc_slow) | |
576 |
|
580 | |||
@@ -594,9 +598,13 b' def run_iptestall(inc_slow=False):' | |||||
594 |
|
598 | |||
595 | print(len(runners)) |
|
599 | print(len(runners)) | |
596 | all_res = p.map(do_run, runners) |
|
600 | all_res = p.map(do_run, runners) | |
|
601 | print('*'*70) | |||
597 | for ((name, runner), res) in zip(runners, all_res): |
|
602 | for ((name, runner), res) in zip(runners, all_res): | |
598 |
print(' |
|
603 | print(' '*70) | |
599 |
|
|
604 | tgroup = 'IPython test group: ' + name | |
|
605 | res_string = 'OK' if res == 0 else 'FAILED' | |||
|
606 | res_string = res_string.rjust(70 - len(tgroup), '.') | |||
|
607 | print(tgroup + res_string) | |||
600 | if res: |
|
608 | if res: | |
601 | failed.append( (name, runner) ) |
|
609 | failed.append( (name, runner) ) | |
602 | if res == -signal.SIGINT: |
|
610 | if res == -signal.SIGINT: | |
@@ -639,13 +647,17 b' def main():' | |||||
639 | # This is in-process |
|
647 | # This is in-process | |
640 | run_iptest() |
|
648 | run_iptest() | |
641 | else: |
|
649 | else: | |
642 |
i |
|
650 | inc_slow = "--all" in sys.argv | |
|
651 | if inc_slow: | |||
643 | sys.argv.remove("--all") |
|
652 | sys.argv.remove("--all") | |
644 | inc_slow = True |
|
653 | ||
645 | else: |
|
654 | fast = "--fast" in sys.argv | |
646 | inc_slow = False |
|
655 | if fast: | |
|
656 | sys.argv.remove("--fast") | |||
|
657 | IPTester.buffer_output = True | |||
|
658 | ||||
647 | # This starts subprocesses |
|
659 | # This starts subprocesses | |
648 | run_iptestall(inc_slow=inc_slow) |
|
660 | run_iptestall(inc_slow=inc_slow, fast=fast) | |
649 |
|
661 | |||
650 |
|
662 | |||
651 | if __name__ == '__main__': |
|
663 | if __name__ == '__main__': |
General Comments 0
You need to be logged in to leave comments.
Login now