Skip to content

Commit 2aadcb1

Browse files
peterlauripelme
authored andcommitted
_django_clear_outbox should clear mail.outbox instead of creating new list (#407)
1 parent 3068be3 commit 2aadcb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytest_django/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ def teardown():
399399

400400

401401
@pytest.fixture(autouse=True, scope='function')
402-
def _django_clear_outbox():
402+
def _django_clear_outbox(django_test_environment):
403403
"""Clear the django outbox, internal to pytest-django."""
404404
if django_settings_is_configured():
405405
from django.core import mail
406-
mail.outbox = []
406+
del mail.outbox[:]
407407

408408

409409
@pytest.fixture(autouse=True, scope='function')

0 commit comments

Comments
 (0)