Skip to content

Commit

Permalink
doc: add clarification for pytest transaction tests (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-kalmykov authored Aug 18, 2024
1 parent 39e1358 commit 0709c5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ For details on why this is required see `here
actually committed, thus your :code:`on_commit()` callbacks will never be run. If you need to
test the results of an :code:`on_commit()` callback, use a :code:`TransactionTestCase` instead.

In case you are writing tests with pytest_, use `@pytest.mark.django_db(transaction=True)
<https://pytest-django.readthedocs.io/en/latest/helpers.html#pytest.mark.django_db>`_ (note the ``transaction=True`` argument).

License
=======
django-cleanup is free software under terms of the:
Expand Down Expand Up @@ -208,6 +211,7 @@ SOFTWARE.


.. _django.test.TransactionTestCase: https://docs.djangoproject.com/en/stable/topics/testing/tools/#django.test.TransactionTestCase
.. _pytest: https://docs.pytest.org
.. _pyenv: https://github.com/pyenv/pyenv
.. _tox: https://tox.readthedocs.io/en/latest/

Expand Down

0 comments on commit 0709c5d

Please sign in to comment.