MCPcopy
hub / github.com/MagicStack/asyncpg / assertRunUnder

Method assertRunUnder

asyncpg/_testbase/__init__.py:143–153  ·  view source on GitHub ↗
(self, delta)

Source from the content-addressed store, hash-verified

141
142 @contextlib.contextmanager
143 def assertRunUnder(self, delta):
144 st = time.monotonic()
145 try:
146 yield
147 finally:
148 elapsed = time.monotonic() - st
149 if elapsed > delta:
150 raise AssertionError(
151 'running block took {:0.3f}s which is longer '
152 'than the expected maximum of {:0.3f}s'.format(
153 elapsed, delta))
154
155 @contextlib.contextmanager
156 def assertLoopErrorHandlerCalled(self, msg_re: str):

Callers 9

test_cancellation_01Method · 0.80
test_timeout_01Method · 0.80
test_timeout_02Method · 0.80
test_timeout_03Method · 0.80
test_timeout_04Method · 0.80
test_timeout_06Method · 0.80

Calls

no outgoing calls

Tested by 9

test_cancellation_01Method · 0.64
test_timeout_01Method · 0.64
test_timeout_02Method · 0.64
test_timeout_03Method · 0.64
test_timeout_04Method · 0.64
test_timeout_06Method · 0.64