Skip to content

Commit 1161f10

Browse files
committed
django_mail_patch_dns: check _django_settings_is_configured:
1 parent 33282a8 commit 1161f10

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pytest_django/plugin.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,12 @@ def mailoutbox(django_mail_patch_dns, _dj_autoclear_mailbox,
577577

578578

579579
@pytest.fixture(scope="function")
580-
def django_mail_patch_dns(monkeypatch, django_mail_dnsname):
581-
from django.core import mail
580+
def django_mail_patch_dns(monkeypatch, django_mail_dnsname,
581+
_django_settings_is_configured):
582+
if _django_settings_is_configured:
583+
from django.core import mail
582584

583-
monkeypatch.setattr(mail.message, "DNS_NAME", django_mail_dnsname)
585+
monkeypatch.setattr(mail.message, "DNS_NAME", django_mail_dnsname)
584586

585587

586588
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)