Changes in tests/pybin/tools.py [0f5da65:8364209]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
r0f5da65 r8364209 175 175 176 176 def which(program): 177 fpath, fname = os.path.split(program) 178 if fpath: 179 if is_exe(program): 180 return program 181 else: 182 for path in os.environ["PATH"].split(os.pathsep): 183 exe_file = os.path.join(path, program) 184 if is_exe(exe_file): 185 return exe_file 186 return None 177 fpath, fname = os.path.split(program) 178 if fpath: 179 if is_exe(program): 180 return program 181 else: 182 for path in os.environ["PATH"].split(os.pathsep): 183 exe_file = os.path.join(path, program) 184 if is_exe(exe_file): 185 return exe_file 186 187 return None 187 188 188 189 @contextlib.contextmanager … … 364 365 365 366 class Timed: 366 367 368 369 370 371 372 367 def __enter__(self): 368 self.start = time.time() 369 return self 370 371 def __exit__(self, *args): 372 self.end = time.time() 373 self.duration = self.end - self.start 373 374 374 375 def timed(src, timeout): 375 376 expire = time.time() + timeout 376 377 i = iter(src) 377 with contextlib.suppress(StopIteration): 378 while True: 379 yield i.next(max(expire - time.time(), 0)) 378 while True: 379 yield i.next(max(expire - time.time(), 0))
Note:
See TracChangeset
for help on using the changeset viewer.