示例#1
0
 def _inner(self, result, pool, child_runner):
     it = pool.imap_unordered(child_runner, self._test_list)
     while True:
         try:
             # A test can't run longer than 2 minutes
             child_result = it.__next__(120)
         except StopIteration:
             return
         result.add_results(child_result)
         if child_result.shouldStop:
             return
示例#2
0
 def _inner(self, result, pool, child_runner):
     it = pool.imap_unordered(child_runner, self._test_list)
     while True:
         try:
             # A test can't run longer than 2 minutes
             child_result = it.__next__(120)
         except StopIteration:
             return
         result.add_results(child_result)
         if child_result.shouldStop:
             return
示例#3
0
 def _run_inner(self, result):
     # We hijack TextTestRunner.run()'s inner logic by passing this
     # method as if it were a test case.
     child_runner = _MinimalRunner(self.runner_cls, self.runner_args)
     pool = multiprocessing.Pool()
     imap = pool.imap_unordered
     try:
         for child_result in imap(child_runner, self._test_list):
             result.add_results(child_result)
             if child_result.shouldStop:
                 break
         return result
     finally:
         # Kill the still active workers
         pool.terminate()
         pool.join()
示例#4
0
 def _run_inner(self, result):
     # We hijack TextTestRunner.run()'s inner logic by passing this
     # method as if it were a test case.
     child_runner = _MinimalRunner(self.runner_cls, self.runner_args)
     pool = multiprocessing.Pool()
     imap = pool.imap_unordered
     try:
         for child_result in imap(child_runner, self._test_list):
             result.add_results(child_result)
             if child_result.shouldStop:
                 break
         return result
     finally:
         # Kill the still active workers
         pool.terminate()
         pool.join()
示例#5
0
文件: __init__.py 项目: hajs/numba
 def _run_parallel_tests(self, result, pool, child_runner):
     remaining_ids = set(t.id() for t in self._ptests)
     it = pool.imap_unordered(child_runner, self._ptests)
     while True:
         try:
             child_result = it.__next__(self.timeout)
         except StopIteration:
             return
         except TimeoutError as e:
             # Diagnose the names of unfinished tests
             msg = "%s [unfinished tests: %s]" % (str(e), ", ".join(map(repr, sorted(remaining_ids))))
             e.args = (msg,) + e.args[1:]
             raise e
         result.add_results(child_result)
         remaining_ids.discard(child_result.test_id)
         if child_result.shouldStop:
             return
示例#6
0
 def _run_parallel_tests(self, result, pool, child_runner):
     remaining_ids = set(t.id() for t in self._ptests)
     it = pool.imap_unordered(child_runner, self._ptests)
     while True:
         try:
             child_result = it.__next__(self.timeout)
         except StopIteration:
             return
         except TimeoutError as e:
             # Diagnose the names of unfinished tests
             msg = ("%s [unfinished tests: %s]" %
                    (str(e), ", ".join(map(repr, sorted(remaining_ids)))))
             e.args = (msg, ) + e.args[1:]
             raise e
         result.add_results(child_result)
         remaining_ids.discard(child_result.test_id)
         if child_result.shouldStop:
             return
示例#7
0
 def _run_parallel_tests(self, result, pool, child_runner):
     remaining_ids = set(t.id() for t in self._ptests)
     it = pool.imap_unordered(child_runner, self._ptests)
     while True:
         try:
             child_result = it.__next__(self.timeout)
         except StopIteration:
             return
         except TimeoutError as e:
             # Diagnose the names of unfinished tests
             msg = ("Tests didn't finish before timeout (or crashed):\n%s" %
                    "".join("- %r\n" % tid
                            for tid in sorted(remaining_ids)))
             e.args = (msg, ) + e.args[1:]
             raise e
         else:
             result.add_results(child_result)
             remaining_ids.discard(child_result.test_id)
             if child_result.shouldStop:
                 result.shouldStop = True
                 return
示例#8
0
 def _run_parallel_tests(self, result, pool, child_runner):
     remaining_ids = set(t.id() for t in self._ptests)
     it = pool.imap_unordered(child_runner, self._ptests)
     while True:
         try:
             child_result = it.__next__(self.timeout)
         except StopIteration:
             return
         except TimeoutError as e:
             # Diagnose the names of unfinished tests
             msg = ("Tests didn't finish before timeout (or crashed):\n%s"
                    % "".join("- %r\n" % tid for tid in sorted(remaining_ids))
                    )
             e.args = (msg,) + e.args[1:]
             raise e
         else:
             result.add_results(child_result)
             remaining_ids.discard(child_result.test_id)
             if child_result.shouldStop:
                 result.shouldStop = True
                 return