Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision 8364209a088ebd8ae4e6495457846de2556556f6)
+++ tests/pybin/tools.py	(revision 0f5da650ab6bd99405e5d9d713898351f76df3cf)
@@ -175,15 +175,14 @@
 
 def which(program):
-    fpath, fname = os.path.split(program)
-    if fpath:
-        if is_exe(program):
-            return program
-    else:
-        for path in os.environ["PATH"].split(os.pathsep):
-            exe_file = os.path.join(path, program)
-            if is_exe(exe_file):
-                return exe_file
-
-    return None
+	fpath, fname = os.path.split(program)
+	if fpath:
+		if is_exe(program):
+			return program
+	else:
+		for path in os.environ["PATH"].split(os.pathsep):
+			exe_file = os.path.join(path, program)
+			if is_exe(exe_file):
+				return exe_file
+	return None
 
 @contextlib.contextmanager
@@ -365,15 +364,16 @@
 
 class Timed:
-    def __enter__(self):
-        self.start = time.time()
-        return self
-
-    def __exit__(self, *args):
-        self.end = time.time()
-        self.duration = self.end - self.start
+	def __enter__(self):
+		self.start = time.time()
+		return self
+
+	def __exit__(self, *args):
+		self.end = time.time()
+		self.duration = self.end - self.start
 
 def timed(src, timeout):
 	expire = time.time() + timeout
 	i = iter(src)
-	while True:
-		yield i.next(max(expire - time.time(), 0))
+	with contextlib.suppress(StopIteration):
+		while True:
+			yield i.next(max(expire - time.time(), 0))
