def wrapped(*args: typing.Any, **kwargs: typing.Any) -> typing.Any: log_event.testcase_begin(tc.__name__) start = time.monotonic() try: result = tc(*args, **kwargs) except: # noqa: E722 log_event.testcase_end(tc.__name__, time.monotonic() - start, False) raise log_event.testcase_end(tc.__name__, time.monotonic() - start, True) return result
def wrapped(*args: typing.Any, **kwargs: typing.Any) -> typing.Any: log_event.testcase_begin(name) start = time.monotonic() try: result = tc(*args, **kwargs) except tbot.SkipException as e: log_event.testcase_end(name, time.monotonic() - start, skipped=str(e)) return None except: # noqa: E722 log_event.testcase_end(name, time.monotonic() - start, False) raise log_event.testcase_end(name, time.monotonic() - start, True) return result
def _testcase_block(name: str) -> typing.Iterator[None]: """Testcase context-manager.""" log_event.testcase_begin(name) start = time.monotonic() try: yield None except SkipException as e: log_event.testcase_end(name, time.monotonic() - start, skipped=str(e)) return None except: # noqa: E722 log_event.testcase_end(name, time.monotonic() - start, False) raise else: log_event.testcase_end(name, time.monotonic() - start, True)