MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / skip_if_timeout

Function skip_if_timeout

lib/sqlalchemy/testing/util.py:523–534  ·  view source on GitHub ↗
(seconds: float, cleanup: Any = None)

Source from the content-addressed store, hash-verified

521
522@contextlib.contextmanager
523def skip_if_timeout(seconds: float, cleanup: Any = None):
524
525 now = time.time()
526 yield
527 sec = time.time() - now
528 if sec > seconds:
529 try:
530 cleanup()
531 finally:
532 config.skip_test(
533 f"test took too long ({sec:.4f} seconds > {seconds})"
534 )

Callers

nothing calls this directly

Calls 2

skip_testMethod · 0.80
timeMethod · 0.45

Tested by

no test coverage detected