Skip to content

Commit e431b2f

Browse files
committed
Add remark in developer coding convention
1 parent cdba9cd commit e431b2f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/doc/en/developer/coding_basics.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,14 @@ written.
966966
checked, as they are the most likely to be broken, now or in the future. This
967967
probably belongs to the TESTS block (see :ref:`section-docstring-function`).
968968

969+
- **Interruption:** if the function might take a very long time, use
970+
:func:`~sage.doctest.util.ensure_interruptible_after` to check that the user
971+
can interrupt it. For example, the following tests ``sleep(3)`` can be
972+
interrupted after 1 second::
973+
974+
sage: from sage.doctest.util import ensure_interruptible_after
975+
sage: with ensure_interruptible_after(1) as data: sleep(3)
976+
969977
- **Systematic tests** of all small-sized inputs, or tests of **random**
970978
instances if possible.
971979

0 commit comments

Comments
 (0)