MCPcopy
hub / github.com/python-trio/trio / assert_checkpoints

Function assert_checkpoints

src/trio/testing/_checkpoints.py:32–49  ·  view source on GitHub ↗

Use as a context manager to check that the code inside the ``with`` block either exits with an exception or executes at least one :ref:`checkpoint `. Raises: AssertionError: if no checkpoint was executed. Example: Check that :func:`trio.sleep` is a checkpoi

()

Source from the content-addressed store, hash-verified

30
31
32def assert_checkpoints() -> AbstractContextManager[None]:
33 """Use as a context manager to check that the code inside the ``with``
34 block either exits with an exception or executes at least one
35 :ref:`checkpoint <checkpoints>`.
36
37 Raises:
38 AssertionError: if no checkpoint was executed.
39
40 Example:
41 Check that :func:`trio.sleep` is a checkpoint, even if it doesn&#x27;t
42 block::
43
44 with trio.testing.assert_checkpoints():
45 await trio.sleep(0)
46
47 """
48 __tracebackhide__ = True
49 return _assert_yields_or_not(True)
50
51
52def assert_no_checkpoints() -> AbstractContextManager[None]:

Callers 15

test_wait_basicFunction · 0.85
block_on_readFunction · 0.85
block_on_writeFunction · 0.85
senderFunction · 0.85
receiverFunction · 0.85
test_trivial_yieldsFunction · 0.85
test_EventFunction · 0.85
test_CapacityLimiterFunction · 0.85
test_SemaphoreFunction · 0.85
test_ConditionFunction · 0.85

Calls 1

_assert_yields_or_notFunction · 0.85

Tested by 15

test_wait_basicFunction · 0.68
block_on_readFunction · 0.68
block_on_writeFunction · 0.68
senderFunction · 0.68
receiverFunction · 0.68
test_trivial_yieldsFunction · 0.68
test_EventFunction · 0.68
test_CapacityLimiterFunction · 0.68
test_SemaphoreFunction · 0.68
test_ConditionFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…