(self)
| 53 | raise BenchTimeoutError(f"Timed out after {self.seconds}s") |
| 54 | |
| 55 | def __enter__(self): |
| 56 | if self._use_signal: |
| 57 | self._old = signal.signal(signal.SIGALRM, self._handler) |
| 58 | signal.alarm(self.seconds) |
| 59 | else: |
| 60 | import threading |
| 61 | self._timer = threading.Timer(self.seconds, self._timeout_thread) |
| 62 | self._timer.daemon = True |
| 63 | self._timed_out = False |
| 64 | self._timer.start() |
| 65 | return self |
| 66 | |
| 67 | def __exit__(self, *exc): |
| 68 | if self._use_signal: |
nothing calls this directly
no outgoing calls
no test coverage detected