Changeset b7d6a36 for tests/pybin/tools.py
- Timestamp:
- Feb 20, 2020, 4:15:51 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6a490b2
- Parents:
- dca5802 (diff), 2cbfe92 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
rdca5802 rb7d6a36 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 187 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 return None 188 187 189 188 @contextlib.contextmanager … … 365 364 366 365 class Timed: 367 368 369 370 371 372 373 366 def __enter__(self): 367 self.start = time.time() 368 return self 369 370 def __exit__(self, *args): 371 self.end = time.time() 372 self.duration = self.end - self.start 374 373 375 374 def timed(src, timeout): 376 375 expire = time.time() + timeout 377 376 i = iter(src) 378 while True: 379 yield i.next(max(expire - time.time(), 0)) 377 with contextlib.suppress(StopIteration): 378 while True: 379 yield i.next(max(expire - time.time(), 0))
Note: See TracChangeset
for help on using the changeset viewer.