git-cl: Fix get_cl_statuses for Python 3 and add tests.

In Python 3 the semantics of `raise StopIteration` inside a generator
function changed.

Bug: 1002209
Change-Id: I51222a5006c4024b3a6a06d344423ee36870825a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2071056
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 9081856..395b460 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -10,7 +10,6 @@
 from __future__ import print_function
 
 from distutils.version import LooseVersion
-from multiprocessing.pool import ThreadPool
 import base64
 import collections
 import datetime
@@ -3418,7 +3417,7 @@
   See GetStatus() for a list of possible statuses.
   """
   if not changes:
-    raise StopIteration()
+    return
 
   if not fine_grained:
     # Fast path which doesn't involve querying codereview servers.
@@ -3445,14 +3444,14 @@
     threads_count = max(1, min(threads_count, max_processes))
   logging.debug('querying %d CLs using %d threads', len(changes), threads_count)
 
-  pool = ThreadPool(threads_count)
+  pool = multiprocessing.pool.ThreadPool(threads_count)
   fetched_cls = set()
   try:
     it = pool.imap_unordered(fetch, changes).__iter__()
     while True:
       try:
         cl, status = it.next(timeout=5)
-      except multiprocessing.TimeoutError:
+      except (multiprocessing.TimeoutError, StopIteration):
         break
       fetched_cls.add(cl)
       yield cl, status