Skip to content

Commit

Permalink
Remove redundant examples
Browse files Browse the repository at this point in the history
These examples show how not to use it. If someone does this, they'll get
helpful error messages anyway, so they are of limited benefit as
examples.
  • Loading branch information
seddonym committed Aug 15, 2024
1 parent 7721b4c commit ab6abd5
Showing 1 changed file with 3 additions and 48 deletions.
51 changes: 3 additions & 48 deletions docs/usage/timeouts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ Example Usage

Here are some examples of how to use the ``apply_timeouts`` function.

======================
Example 1: Basic Usage
======================
=======
Example
=======

.. code-block:: python
Expand All @@ -84,48 +84,3 @@ Example 1: Basic Usage
# We are back to the parent block, so lock timeout is 10s again.
...
=====================================================
Example 2: Invalid Parameters: Missing timeout values
=====================================================

.. code-block:: python
import datetime
from django_pg_migration_tools import timeouts
with timeouts.apply_timeouts(
using="default",
):
pass
**Output:**

.. code-block:: text
django_pg_migration_tools.timeouts.TimeoutNotProvided: Caller must set at least one of `lock_timeout` or `statement_timeout`.
=============================================================
Example 3: Invalid Parameters: Negative timeout not permitted
=============================================================

.. code-block:: python
import datetime
from django_pg_migration_tools import timeouts
with timeouts.apply_timeouts(
using="default",
lock_timeout=datetime.timedelta(seconds=-5),
# Either lock_timeout or statement_timeout negative.
# The following would've raised an error as well.
# statement_timeout=datetime.timedelta(seconds=-5),
):
pass
**Output:**

.. code-block:: text
django_pg_migration_tools.timeouts.TimeoutWasNotPositive: Timeouts must be greater than zero.

0 comments on commit ab6abd5

Please sign in to comment.