Skip to content

Commit 8f104d2

Browse files
authored
Add workaround for old mail.outbox
1 parent f18a4d1 commit 8f104d2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/changelog.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ Compatibility
3030
removed. If you have relied on this to get an empty outbox for your
3131
test, you should change tests to use the ``mailoutbox`` fixture instead.
3232
See documentation of ``mailoutbox`` fixture for usage. If you try to
33-
access mail.outbox directly, AssertionError will be raised.
33+
access mail.outbox directly, AssertionError will be raised. If you
34+
previously relied on the old behaviour and do not want to change your
35+
tests, put this in your project conftest.py::
36+
37+
@pytest.fixture(autouse=True)
38+
def clear_outbox():
39+
from django.core import mail
40+
mail.outbox = []
41+
3442

3543
3.0.0
3644
-----

0 commit comments

Comments
 (0)